Skip to content

Commit

Permalink
Added unit test for unsolicited ImapFolder.AnnotationChanged events
Browse files Browse the repository at this point in the history
  • Loading branch information
jstedfast committed Sep 14, 2023
1 parent f048844 commit 832d765
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion UnitTests/Net/Imap/ImapFolderFetchTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1331,7 +1331,8 @@ static List<ImapReplayCommand> CreateFetchAnnotationsCommands ()
new ImapReplayCommand ("A00000002 LIST \"\" \"INBOX\" RETURN (SUBSCRIBED CHILDREN)\r\n", "dovecot.list-inbox.txt"),
new ImapReplayCommand ("A00000003 LIST (SPECIAL-USE) \"\" \"*\" RETURN (SUBSCRIBED CHILDREN)\r\n", "dovecot.list-special-use.txt"),
new ImapReplayCommand ("A00000004 SELECT INBOX (CONDSTORE ANNOTATE)\r\n", "common.select-inbox-annotate-readonly.txt"),
new ImapReplayCommand ("A00000005 FETCH 1:* (UID ANNOTATION (/* (value size)))\r\n", "common.fetch-annotations.txt")
new ImapReplayCommand ("A00000005 FETCH 1:* (UID ANNOTATION (/* (value size)))\r\n", "common.fetch-annotations.txt"),
new ImapReplayCommand ("A00000006 NOOP\r\n", "common.fetch-annotations.txt"),
};
}

Expand Down Expand Up @@ -1400,6 +1401,16 @@ public void TestFetchAnnotations ()
Assert.AreEqual ("10", annotations[0].Properties[AnnotationAttribute.PrivateSize], "annotations[0] size.priv");
Assert.AreEqual ("0", annotations[0].Properties[AnnotationAttribute.SharedSize], "annotations[0] size.shared");

var annotationsChanged = new List<AnnotationsChangedEventArgs> ();

inbox.AnnotationsChanged += (sender, e) => {
annotationsChanged.Add (e);
};

client.NoOp ();

Assert.AreEqual (3, annotationsChanged.Count, "# AnnotationsChanged events");

client.Disconnect (false);
}
}
Expand Down Expand Up @@ -1469,6 +1480,16 @@ public async Task TestFetchAnnotationsAsync ()
Assert.AreEqual ("10", annotations[0].Properties[AnnotationAttribute.PrivateSize], "annotations[0] size.priv");
Assert.AreEqual ("0", annotations[0].Properties[AnnotationAttribute.SharedSize], "annotations[0] size.shared");

var annotationsChanged = new List<AnnotationsChangedEventArgs> ();

inbox.AnnotationsChanged += (sender, e) => {
annotationsChanged.Add (e);
};

await client.NoOpAsync ();

Assert.AreEqual (3, annotationsChanged.Count, "# AnnotationsChanged events");

client.Disconnect (false);
}
}
Expand Down

0 comments on commit 832d765

Please sign in to comment.