public void Test_IsSatisfiedBy_LessThan_Null() { var sc = new SearchCondition <int>(); //expect same behaviour as SQL sc.LessThan(1); Assert.IsFalse(sc.IsSatisfiedBy(null)); }
public void Test_IsSatisfiedBy_LessThan() { var sc = new SearchCondition <int>(); sc.LessThan(1); Assert.IsTrue(sc.IsSatisfiedBy(0)); Assert.IsFalse(sc.IsSatisfiedBy(1)); Assert.IsFalse(sc.IsSatisfiedBy(2)); }
public void Test_LessThan() { var sc = new SearchCondition <object>(); var x = new object(); sc.LessThan(x); Assert.AreEqual(1, sc.Values.Length); Assert.AreEqual(x, sc.Values[0]); Assert.AreEqual(SearchConditionTest.LessThan, sc.Test); }
public void Test_IsSatisfiedBy_LessThan_Null() { var sc = new SearchCondition<int>(); //expect same behaviour as SQL sc.LessThan(1); Assert.IsFalse(sc.IsSatisfiedBy(null)); }
public void Test_IsSatisfiedBy_LessThan() { var sc = new SearchCondition<int>(); sc.LessThan(1); Assert.IsTrue(sc.IsSatisfiedBy(0)); Assert.IsFalse(sc.IsSatisfiedBy(1)); Assert.IsFalse(sc.IsSatisfiedBy(2)); }
public void Test_LessThan() { var sc = new SearchCondition<object>(); var x = new object(); sc.LessThan(x); Assert.AreEqual(1, sc.Values.Length); Assert.AreEqual(x, sc.Values[0]); Assert.AreEqual(SearchConditionTest.LessThan, sc.Test); }
public RetrieverResponse Retrieve(Service service, DateTime DefaultSyncDate, EbStaticFileClient FileClient, string SolnId, bool isMq, bool SubmitAttachmentAsMultipleForm) { RetrieverResponse response = new RetrieverResponse(); using (ImapClient Client = new ImapClient(Config.Host, Config.Port, Config.EmailAddress, Config.Password, S22.Imap.AuthMethod.Login, true)) { try { LastSyncedUid = service.Redis.Get <uint>("MailRetrieve_LastsyncedId_" + this.ConId); if (LastSyncedUid == 0)// if value is not in redis { IEnumerable <uint> x = Client.Search(SearchCondition.SentSince(DefaultSyncDate)); uidsCount = x.Count(); if (uidsCount > 0) { LastSyncedUid = x.Min(); } } uidsCount = (uidsCount == 0) ? Client.Search(SearchCondition.GreaterThan(LastSyncedUid)).Where(a => a != MaxUid) .Where(a => a != LastSyncedUid).Count() : uidsCount; if (uidsCount > 0) { MaxUid = LastSyncedUid; for (int i = 0; i <= uidsCount / 50; i++) { IEnumerable <uint> uids = Client.Search(SearchCondition.GreaterThan(MaxUid).And(SearchCondition.LessThan(MaxUid + 51))); MaxUid = uids.Count() > 0 ? uids.Max() : MaxUid; IEnumerable <MailMessage> messages = Client.GetMessages(uids); foreach (MailMessage m in messages) { List <int> _attachments = new List <int>(); List <string> attachment_names = new List <string>();; foreach (System.Net.Mail.Attachment _a in m.Attachments) { int fileId = UploadAttachment(_a, service, SolnId, isMq); _attachments.Add(fileId); if (SubmitAttachmentAsMultipleForm) { response.RetrieverMessages.Add(new RetrieverMessage { Message = m, Attachemnts = _attachments, AttachmentsName = _a.Name }); _attachments = new List <int>(); } else { attachment_names.Add(_a.Name); } } if (!SubmitAttachmentAsMultipleForm || m.Attachments.Count == 0) { response.RetrieverMessages.Add(new RetrieverMessage { Message = m, Attachemnts = _attachments, AttachmentsName = string.Join(',', attachment_names) }); } } } service.Redis.Set("MailRetrieve_LastsyncedId_" + this.ConId, MaxUid); } } catch (S22.Imap.InvalidCredentialsException) { Console.WriteLine("The server rejected the supplied credentials."); } } return(response); }