diff options
author | Brandon West <brawest@gmail.com> | 2014-10-07 15:30:59 -0600 |
---|---|---|
committer | Brandon West <brawest@gmail.com> | 2014-10-07 15:30:59 -0600 |
commit | d9a3ace4faefa9222c64db0f549285767209e8a6 (patch) | |
tree | 7d1a85b3015c5128140d5b61539448e0ecfef5e3 | |
parent | ca91fad22dfec2cd1219267fe979c1d9a33a522e (diff) | |
download | sendgrid-csharp-d9a3ace4faefa9222c64db0f549285767209e8a6.zip sendgrid-csharp-d9a3ace4faefa9222c64db0f549285767209e8a6.tar.gz sendgrid-csharp-d9a3ace4faefa9222c64db0f549285767209e8a6.tar.bz2 |
line endings and whitespace
-rw-r--r-- | SendGrid/SendGridMail/Transport/Web.cs | 2 | ||||
-rw-r--r-- | SendGrid/Tests/Transport/TestWebApi.cs | 148 |
2 files changed, 75 insertions, 75 deletions
diff --git a/SendGrid/SendGridMail/Transport/Web.cs b/SendGrid/SendGridMail/Transport/Web.cs index 24202bf..f5ea706 100644 --- a/SendGrid/SendGridMail/Transport/Web.cs +++ b/SendGrid/SendGridMail/Transport/Web.cs @@ -44,8 +44,8 @@ namespace SendGrid {
BaseAddress = new Uri("https://" + BaseUrl)
};
- client.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", "sendgrid/4.0.1;csharp");
+ client.DefaultRequestHeaders.TryAddWithoutValidation("User-Agent", "sendgrid/4.0.1;csharp");
var content = new MultipartFormDataContent();
AttachFormParams(message, content);
diff --git a/SendGrid/Tests/Transport/TestWebApi.cs b/SendGrid/Tests/Transport/TestWebApi.cs index 6a4fa0c..0c847a9 100644 --- a/SendGrid/Tests/Transport/TestWebApi.cs +++ b/SendGrid/Tests/Transport/TestWebApi.cs @@ -1,82 +1,82 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; +using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
using System.Net.Mail;
-using Moq; -using NUnit.Framework; -using SendGrid; - -namespace Tests.Transport -{ - [TestFixture] - internal class TestWebApi - { - private const string TestUsername = "username"; - private const string TestPassword = "password"; - - [Test] - public void TestFetchFileBodies() - { - var webApi = new Web(new NetworkCredential(TestUsername, TestPassword)); - var message = new Mock<ISendGrid>(); - var attachments = new[] {"foo", "bar", "foobar"}; - message.SetupProperty(foo => foo.Attachments, null); - var result = webApi.FetchFileBodies(message.Object); - Assert.AreEqual(0, result.Count); - - message.SetupProperty(foo => foo.Attachments, attachments); - result = webApi.FetchFileBodies(message.Object); - Assert.AreEqual(attachments.Count(), result.Count); - for (var index = 0; index < attachments.Length; index++) - Assert.AreEqual(result[index].Value.Name, attachments[index]); - } - - [Test] - public void TestFetchFormParams() - { - // Test Variables +using Moq;
+using NUnit.Framework;
+using SendGrid;
+
+namespace Tests.Transport
+{
+ [TestFixture]
+ internal class TestWebApi
+ {
+ private const string TestUsername = "username";
+ private const string TestPassword = "password";
+
+ [Test]
+ public void TestFetchFileBodies()
+ {
+ var webApi = new Web(new NetworkCredential(TestUsername, TestPassword));
+ var message = new Mock<ISendGrid>();
+ var attachments = new[] {"foo", "bar", "foobar"};
+ message.SetupProperty(foo => foo.Attachments, null);
+ var result = webApi.FetchFileBodies(message.Object);
+ Assert.AreEqual(0, result.Count);
+
+ message.SetupProperty(foo => foo.Attachments, attachments);
+ result = webApi.FetchFileBodies(message.Object);
+ Assert.AreEqual(attachments.Count(), result.Count);
+ for (var index = 0; index < attachments.Length; index++)
+ Assert.AreEqual(result[index].Value.Name, attachments[index]);
+ }
+
+ [Test]
+ public void TestFetchFormParams()
+ {
+ // Test Variables
const string toAddress = "foobar@outlook.com";
const string ccAddress = "cc@outlook.com";
const string bcc1Address = "bcc1@outlook.com";
const string bcc2Address = "bcc2@outlook.com";
- MailAddress[] bccAddresses = {new MailAddress(bcc1Address), new MailAddress(bcc2Address)}; - const string fromAddress = "test@outlook.com"; - const string subject = "Test Subject"; - const string textBody = "Test Text Body"; - const string htmlBody = "<p>Test HTML Body</p>"; - const string headerKey = "headerkey"; - var testHeader = new Dictionary<string, string> { { headerKey, "headervalue" } }; - const string categoryName = "Example Category"; - - var message = new SendGridMessage(); - message.AddTo(toAddress); + MailAddress[] bccAddresses = {new MailAddress(bcc1Address), new MailAddress(bcc2Address)};
+ const string fromAddress = "test@outlook.com";
+ const string subject = "Test Subject";
+ const string textBody = "Test Text Body";
+ const string htmlBody = "<p>Test HTML Body</p>";
+ const string headerKey = "headerkey";
+ var testHeader = new Dictionary<string, string> { { headerKey, "headervalue" } };
+ const string categoryName = "Example Category";
+
+ var message = new SendGridMessage();
+ message.AddTo(toAddress);
message.AddCc(ccAddress);
- message.Bcc = bccAddresses; - message.From = new MailAddress(fromAddress); - message.Subject = subject; - message.Text = textBody; - message.Html = htmlBody; - message.AddHeaders(testHeader); - message.Header.SetCategory(categoryName); - - var webApi = new Web(new NetworkCredential(TestUsername, TestPassword)); - var result = webApi.FetchFormParams(message); - Assert.True(result.Any(r => r.Key == "api_user" && r.Value == TestUsername)); - Assert.True(result.Any(r => r.Key == "api_key" && r.Value == TestPassword)); - Assert.True(result.Any(r => r.Key == "to[]" && r.Value == toAddress)); - Assert.True(result.Any(r => r.Key == "cc[]" && r.Value == ccAddress)); + message.Bcc = bccAddresses;
+ message.From = new MailAddress(fromAddress);
+ message.Subject = subject;
+ message.Text = textBody;
+ message.Html = htmlBody;
+ message.AddHeaders(testHeader);
+ message.Header.SetCategory(categoryName);
+
+ var webApi = new Web(new NetworkCredential(TestUsername, TestPassword));
+ var result = webApi.FetchFormParams(message);
+ Assert.True(result.Any(r => r.Key == "api_user" && r.Value == TestUsername));
+ Assert.True(result.Any(r => r.Key == "api_key" && r.Value == TestPassword));
+ Assert.True(result.Any(r => r.Key == "to[]" && r.Value == toAddress));
+ Assert.True(result.Any(r => r.Key == "cc[]" && r.Value == ccAddress));
Assert.True(result.Any(r => r.Key == "bcc[]" && r.Value == bcc1Address));
- Assert.True(result.Any(r => r.Key == "bcc[]" && r.Value == bcc2Address)); - Assert.True(result.Any(r => r.Key == "from" && r.Value == fromAddress)); - Assert.True(result.Any(r => r.Key == "subject" && r.Value == subject)); - Assert.True(result.Any(r => r.Key == "text" && r.Value == textBody)); - Assert.True(result.Any(r => r.Key == "html" && r.Value == htmlBody)); - Assert.True( - result.Any( - r => r.Key == "headers" && r.Value == String.Format("{{\"{0}\":\"{1}\"}}", headerKey, testHeader[headerKey]))); - Assert.True( - result.Any(r => r.Key == "x-smtpapi" && r.Value == String.Format("{{\"category\" : \"{0}\"}}", categoryName))); - } - } + Assert.True(result.Any(r => r.Key == "bcc[]" && r.Value == bcc2Address));
+ Assert.True(result.Any(r => r.Key == "from" && r.Value == fromAddress));
+ Assert.True(result.Any(r => r.Key == "subject" && r.Value == subject));
+ Assert.True(result.Any(r => r.Key == "text" && r.Value == textBody));
+ Assert.True(result.Any(r => r.Key == "html" && r.Value == htmlBody));
+ Assert.True(
+ result.Any(
+ r => r.Key == "headers" && r.Value == String.Format("{{\"{0}\":\"{1}\"}}", headerKey, testHeader[headerKey])));
+ Assert.True(
+ result.Any(r => r.Key == "x-smtpapi" && r.Value == String.Format("{{\"category\" : \"{0}\"}}", categoryName)));
+ }
+ }
}
\ No newline at end of file |