Example #1
0
        public static void PrintEmails(object sender, ElapsedEventArgs e)
        {
            IEmailApi api = new GmailApi();

            var filterConfigFile = new IgnoreFiltersConfigFile();

            filterConfigFile.Clear();
            filterConfigFile.Append(new Filter(FilterOption.AllFolders));
            //filterConfigFile.Append(new List<Filter>()
            //{
            //    new Filter(FilterOption.AllFolders),
            //    new Filter(FilterOption.Read)
            //});

            var filters = filterConfigFile.GetFilters();
            var query   = new GmailQuery(filters);
            var emails  = api.GetEmails(query);

            emails.ForEach(email =>
                           Console.WriteLine($"Email ID: {email.Id} Time received: {email.TimeReceived}. " +
                                             $"Subject: {email.Subject} Time: {email.TimeReceived}"));

            Console.WriteLine("-----------------------");
        }
Example #2
0
 public void GetEmailsTest(GmailQuery input, int numOfRetrievedEmails)
 {
     Assert.True(GmailApi.GetEmails(input).Count >= numOfRetrievedEmails);
 }