Esempio n. 1
0
        public void UseNewerThan_LessThanOneDay_CorrectDaysInQuery()
        {
            var request = new GmailRequestBuilder()
                          .UseNewerThan(DateTimeOffset.Now.AddDays(-1).AddMinutes(10))
                          .Request;

            Assert.IsTrue(request.Query.Contains("newer_than:1d"));
        }
Esempio n. 2
0
        public void UseLabel_LabelInRequestQuery()
        {
            var request = new GmailRequestBuilder()
                          .UseLabel("label")
                          .Request;

            Assert.IsTrue(request.Query.Contains("in:\"label\""));
        }
Esempio n. 3
0
        public void UseSubject_SubjectInRequestQuery()
        {
            var request = new GmailRequestBuilder()
                          .UseSubject("something")
                          .Request;

            Assert.IsTrue(request.Query.Contains("subject:\"something\""));
        }
Esempio n. 4
0
        public void UseFrom_FromInRequestQuery()
        {
            var request = new GmailRequestBuilder()
                          .UseFrom("*****@*****.**")
                          .Request;

            Assert.IsTrue(request.Query.Contains("from:\"[email protected]\""));
        }
Esempio n. 5
0
        public void UseSnippetRegex_RegexInRequest()
        {
            var regex   = new Regex("\\d{10}");
            var request = new GmailRequestBuilder()
                          .UseSnippetRegex(regex)
                          .Request;

            Assert.AreEqual(regex, request.SnippetRegex);
        }
Esempio n. 6
0
        public void UseNewerThan_NewerThanInRequest()
        {
            var newerThan = DateTimeOffset.Now.AddDays(-1).AddMinutes(-10);

            var request = new GmailRequestBuilder()
                          .UseNewerThan(newerThan)
                          .Request;

            Assert.AreEqual(newerThan, request.NewerThan);
        }
Esempio n. 7
0
        private static string ExtractEmailContentUsingWrapperApi(UserCredential credential)
        {
            var gmailService = new GmailServiceWrapper("{your app name}", credential);

            var request = new GmailRequestBuilder()
                          .UseFrom("{from email address}")
                          .UseSubject("{email subject}")
                          .UseLabel("{email label/category}")
                          .UseNewerThan(DateTimeOffset.Now.AddMinutes(-10))
                          .UseSnippetRegex(new Regex(".*"))
                          .Request;

            var content = gmailService.ExtractEmailSnippetContent(request);

            return(content);
        }