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")); }
public void UseLabel_LabelInRequestQuery() { var request = new GmailRequestBuilder() .UseLabel("label") .Request; Assert.IsTrue(request.Query.Contains("in:\"label\"")); }
public void UseSubject_SubjectInRequestQuery() { var request = new GmailRequestBuilder() .UseSubject("something") .Request; Assert.IsTrue(request.Query.Contains("subject:\"something\"")); }
public void UseFrom_FromInRequestQuery() { var request = new GmailRequestBuilder() .UseFrom("*****@*****.**") .Request; Assert.IsTrue(request.Query.Contains("from:\"[email protected]\"")); }
public void UseSnippetRegex_RegexInRequest() { var regex = new Regex("\\d{10}"); var request = new GmailRequestBuilder() .UseSnippetRegex(regex) .Request; Assert.AreEqual(regex, request.SnippetRegex); }
public void UseNewerThan_NewerThanInRequest() { var newerThan = DateTimeOffset.Now.AddDays(-1).AddMinutes(-10); var request = new GmailRequestBuilder() .UseNewerThan(newerThan) .Request; Assert.AreEqual(newerThan, request.NewerThan); }
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); }