public void FindSearchExpressionTest() { using (var client = new ImapClient()) { var query = client.Messages.Where(x => x.SequenceNumber > 0 && x.SequenceNumber < 20).Select(x => new SampleContainer { MySubject = x.Subject }); var expression = new ExpressionCrawler().FindSearchLambda(query.Expression); Assert.IsNotNull(expression); } }
public void TranslateFetchSelectTest() { using (var client = new ImapClient()) { var query = client.Messages.Where(x => x.SequenceNumber == 1).Select(x => new SampleContainer { MySubject = x.Subject }); ResponseProcessor projector; var translator = new ImapFetchQueryTranslator(); var expression = new ExpressionCrawler().FindFetchLamda(query.Expression); var actual = translator.Translate(expression, "1:10", out projector); const string expected = "FETCH 1:10 (BODY[HEADER.FIELDS (Subject)])"; Assert.AreEqual(expected, actual); } }
public void TranslateFetchRecursiveBodyPartsTest() { using (var client = new ImapClient()) { var query = client.Messages.Where(x => x.SequenceNumber == 1).Select(x => new SampleContainer { MyText = (string)x.Parts("1.Text"), MyPart = (string)x.Parts("1.2") }); ResponseProcessor projector; var translator = new ImapFetchQueryTranslator(); var expression = new ExpressionCrawler().FindFetchLamda(query.Expression); var actual = translator.Translate(expression, "1:10", out projector); const string expected = "FETCH 1:10 (BODY[1.TEXT] BODY[1.2])"; Assert.AreEqual(expected, actual); } }