summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrandon West <brawest@gmail.com>2014-05-21 17:23:35 -0600
committerBrandon West <brawest@gmail.com>2014-05-21 17:23:35 -0600
commite497caefcf35acf753d35f41c209fa09f6d40e99 (patch)
treeb787e0c3007922cb1291a52b2efc1d6922d8813e
parentc48471c02bc8e9d47e4735fda5e3244636b118ef (diff)
downloadsendgrid-csharp-e497caefcf35acf753d35f41c209fa09f6d40e99.zip
sendgrid-csharp-e497caefcf35acf753d35f41c209fa09f6d40e99.tar.gz
sendgrid-csharp-e497caefcf35acf753d35f41c209fa09f6d40e99.tar.bz2
change namespace from SendGridMail to SendGrid, change SendGrid type to SendGridMessage, update to depend on SendGrid.SmtpApi, remove CC and BCC methods since they are not supported in the web API currently.
-rw-r--r--SendGrid/Example/Example.csproj1
-rw-r--r--SendGrid/Example/Program.cs6
-rw-r--r--SendGrid/Example/WEBAPI.cs34
-rw-r--r--SendGrid/Example/app.config4
-rw-r--r--SendGrid/Example/packages.config7
-rw-r--r--SendGrid/SendGridMail/ISendGrid.cs58
-rw-r--r--SendGrid/SendGridMail/Mail.csproj7
-rw-r--r--SendGrid/SendGridMail/Properties/AssemblyInfo.cs4
-rw-r--r--SendGrid/SendGridMail/SendGrid.cs62
-rw-r--r--SendGrid/SendGridMail/Transport/ITransport.cs2
-rw-r--r--SendGrid/SendGridMail/Transport/Web.cs10
-rw-r--r--SendGrid/SendGridMail/packages.config19
-rw-r--r--SendGrid/Tests/TestSendgrid.cs48
-rw-r--r--SendGrid/Tests/Tests.csproj5
-rw-r--r--SendGrid/Tests/Transport/TestWebApi.cs10
-rw-r--r--SendGrid/Tests/packages.config12
16 files changed, 98 insertions, 191 deletions
diff --git a/SendGrid/Example/Example.csproj b/SendGrid/Example/Example.csproj
index 14020fc..235df7a 100644
--- a/SendGrid/Example/Example.csproj
+++ b/SendGrid/Example/Example.csproj
@@ -80,7 +80,6 @@
<None Include="app.config">
<SubType>Designer</SubType>
</None>
- <None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SendGridMail\Mail.csproj">
diff --git a/SendGrid/Example/Program.cs b/SendGrid/Example/Program.cs
index 275f6b9..9aaa8ec 100644
--- a/SendGrid/Example/Program.cs
+++ b/SendGrid/Example/Program.cs
@@ -1,7 +1,7 @@
using System;
using System.Net;
using System.Net.Mail;
-using SendGridMail;
+using SendGrid;
namespace Example
{
@@ -11,10 +11,10 @@ namespace Example
private static void Main()
{
// Create the email object first, then add the properties.
- var myMessage = new SendGrid();
+ var myMessage = new SendGridMessage();
myMessage.AddTo("anna@example.com");
myMessage.From = new MailAddress("john@example.com", "John Smith");
- myMessage.Subject = "Testing the SendGrid Library";
+ myMessage.Subject = "Testing the SendGridMessage Library";
myMessage.Text = "Hello World!";
// Create credentials, specifying your user name and password.
diff --git a/SendGrid/Example/WEBAPI.cs b/SendGrid/Example/WEBAPI.cs
index 862a96a..ba6810a 100644
--- a/SendGrid/Example/WEBAPI.cs
+++ b/SendGrid/Example/WEBAPI.cs
@@ -2,7 +2,7 @@
using System.Collections.Generic;
using System.Net;
using System.Net.Mail;
-using SendGridMail;
+using SendGrid;
namespace Example
{
@@ -27,7 +27,7 @@ namespace Example
public void SimpleHTMLEmail()
{
//create a new message object
- var message = new SendGrid();
+ var message = new SendGridMessage();
//set the message recipients
foreach (var recipient in _to)
@@ -57,7 +57,7 @@ namespace Example
public void SimplePlaintextEmail()
{
//create a new message object
- var message = new SendGrid();
+ var message = new SendGridMessage();
//set the message recipients
foreach (var recipient in _to)
@@ -89,7 +89,7 @@ namespace Example
public void EnableGravatarEmail()
{
//create a new message object
- var message = new SendGrid();
+ var message = new SendGridMessage();
//set the message recipients
foreach (var recipient in _to)
@@ -123,7 +123,7 @@ namespace Example
public void EnableOpenTrackingEmail()
{
//create a new message object
- var message = new SendGrid();
+ var message = new SendGridMessage();
//set the message recipients
foreach (var recipient in _to)
@@ -158,7 +158,7 @@ namespace Example
public void EnableClickTrackingEmail()
{
//create a new message object
- var message = new SendGrid();
+ var message = new SendGridMessage();
//set the message recipients
foreach (var recipient in _to)
@@ -191,13 +191,13 @@ namespace Example
/// <summary>
/// The Spam Checker filter, is useful when your web application allows your end users
- /// to create content that is then emailed through your SendGrid account.
+ /// to create content that is then emailed through your SendGridMessage account.
/// http://docs.sendgrid.com/documentation/apps/spam-checker-filter/
/// </summary>
public void EnableSpamCheckEmail()
{
//create a new message object
- var message = new SendGrid();
+ var message = new SendGridMessage();
//set the message recipients
foreach (var recipient in _to)
@@ -233,7 +233,7 @@ namespace Example
public void EnableUnsubscribeEmail()
{
//create a new message object
- var message = new SendGrid();
+ var message = new SendGridMessage();
//set the message recipients
foreach (var recipient in _to)
@@ -272,7 +272,7 @@ namespace Example
public void EnableFooterEmail()
{
//create a new message object
- var message = new SendGrid();
+ var message = new SendGridMessage();
//set the message recipients
foreach (var recipient in _to)
@@ -310,7 +310,7 @@ namespace Example
public void EnableGoogleAnalytics()
{
//create a new message object
- var message = new SendGrid();
+ var message = new SendGridMessage();
//set the message recipients
foreach (var recipient in _to)
@@ -350,7 +350,7 @@ namespace Example
public void EnableTemplateEmail()
{
//create a new message object
- var message = new SendGrid();
+ var message = new SendGridMessage();
//set the message recipients
foreach (var recipient in _to)
@@ -389,7 +389,7 @@ namespace Example
public void EnableBypassListManagementEmail()
{
//create a new message object
- var message = new SendGrid();
+ var message = new SendGridMessage();
//set the message recipients
foreach (var recipient in _to)
@@ -428,7 +428,7 @@ namespace Example
public void AddSubstitutionValues()
{
//create a new message object
- var message = new SendGrid();
+ var message = new SendGridMessage();
//set the message recipients
foreach (var recipient in _to)
@@ -470,7 +470,7 @@ namespace Example
public void AddUniqueIdentifiers()
{
//create a new message object
- var message = new SendGrid();
+ var message = new SendGridMessage();
//set the message recipients
foreach (var recipient in _to)
@@ -505,12 +505,12 @@ namespace Example
/// <summary>
/// This feature tags the message with a specific tracking category, which will have aggregated stats
- /// viewable from your SendGrid account page.
+ /// viewable from your SendGridMessage account page.
/// </summary>
public void SetCategory()
{
//create a new message object
- var message = new SendGrid();
+ var message = new SendGridMessage();
//set the message recipients
foreach (var recipient in _to)
diff --git a/SendGrid/Example/app.config b/SendGrid/Example/app.config
index 6e06702..119ca3a 100644
--- a/SendGrid/Example/app.config
+++ b/SendGrid/Example/app.config
@@ -14,6 +14,10 @@
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.6.0" newVersion="2.6.6.0" />
</dependentAssembly>
+ <dependentAssembly>
+ <assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-2.2.18.0" newVersion="2.2.18.0" />
+ </dependentAssembly>
</assemblyBinding>
</runtime>
</configuration> \ No newline at end of file
diff --git a/SendGrid/Example/packages.config b/SendGrid/Example/packages.config
deleted file mode 100644
index e6019ad..0000000
--- a/SendGrid/Example/packages.config
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<packages>
- <package id="Microsoft.Bcl" version="1.1.6" targetFramework="net40" />
- <package id="Microsoft.Bcl.Build" version="1.0.13" targetFramework="net40" />
- <package id="Microsoft.Net.Http" version="2.2.18" targetFramework="net40" />
-</packages> \ No newline at end of file
diff --git a/SendGrid/SendGridMail/ISendGrid.cs b/SendGrid/SendGridMail/ISendGrid.cs
index 534e644..b487741 100644
--- a/SendGrid/SendGridMail/ISendGrid.cs
+++ b/SendGrid/SendGridMail/ISendGrid.cs
@@ -2,9 +2,9 @@
using System.Collections.Generic;
using System.IO;
using System.Net.Mail;
-using Smtpapi;
+using SendGrid.SmtpApi;
-namespace SendGridMail
+namespace SendGrid
{
/// <summary>
/// Represents the basic set of functions that will be called by the user
@@ -64,50 +64,6 @@ namespace SendGridMail
void AddTo(IDictionary<String, IDictionary<String, String>> addresssInfo);
/// <summary>
- /// Add to the 'CC' address.
- /// </summary>
- /// <param name="address">a single email address eg "you@company.com"</param>
- void AddCc(String address);
-
- /// <summary>
- /// Add to the 'CC' address.
- /// </summary>
- /// <param name="addresses">a list of email addresses as strings</param>
- void AddCc(IEnumerable<String> addresses);
-
- /// <summary>
- /// Add to the 'CC' address.
- /// </summary>
- /// <param name="addresssInfo">
- /// the dictionary keys are the email addresses, which points to a dictionary of
- /// key substitutionValues pairs mapping to other address codes, such as { foo@bar.com => { 'DisplayName' => 'Mr Foo' }
- /// }
- /// </param>
- void AddCc(IDictionary<String, IDictionary<String, String>> addresssInfo);
-
- /// <summary>
- /// Add to the 'Bcc' address.
- /// </summary>
- /// <param name="address">a single email as the input eg "you@company.com"</param>
- void AddBcc(String address);
-
- /// <summary>
- /// Add to the 'Bcc' address.
- /// </summary>
- /// <param name="addresses">a list of emails as an array of strings.</param>
- void AddBcc(IEnumerable<String> addresses);
-
- /// <summary>
- /// Add to the 'Bcc' address.
- /// </summary>
- /// <param name="addresssInfo">
- /// the dictionary keys are the email addresses, which points to a dictionary of
- /// key substitutionValues pairs mapping to other address codes, such as { foo@bar.com => { 'DisplayName' => 'Mr Foo' }
- /// }
- /// </param>
- void AddBcc(IDictionary<String, IDictionary<String, String>> addresssInfo);
-
- /// <summary>
/// Defines a mapping between a replacement string in the text of the message to a list of
/// substitution values to be used, one per each recipient, in the same order as the recipients were added.
/// </summary>
@@ -119,7 +75,7 @@ namespace SendGridMail
void AddSubstitution(String replacementTag, List<String> substitutionValues);
/// <summary>
- /// This adds parameters and values that will be bassed back through SendGrid's
+ /// This adds parameters and values that will be bassed back through SendGridMessage's
/// Event API if an event notification is triggered by this email.
/// </summary>
/// <param name="identifiers">parameter substitutionValues pairs to be passed back on event notification</param>
@@ -235,7 +191,7 @@ namespace SendGridMail
void EnableOpenTracking();
/// <summary>
- /// Causes all links to be overwritten, shortened, and pointed to SendGrid's servers so clicks will be tracked.
+ /// Causes all links to be overwritten, shortened, and pointed to SendGridMessage's servers so clicks will be tracked.
/// </summary>
/// <param name="includePlainText">true if links found in plain text portions of the message are to be overwritten</param>
void EnableClickTracking(bool includePlainText = false);
@@ -247,18 +203,18 @@ namespace SendGridMail
/// Emails with a SpamAssassin score over this substitutionValues will be considered spam and not be
/// delivered.
/// </param>
- /// <param name="url">SendGrid will send an HTTP POST request to this url when a message is detected as spam</param>
+ /// <param name="url">SendGridMessage will send an HTTP POST request to this url when a message is detected as spam</param>
void EnableSpamCheck(int score = 5, String url = null);
/// <summary>
- /// Allow's SendGrid to manage unsubscribes and ensure these users don't get future emails from the sender
+ /// Allow's SendGridMessage to manage unsubscribes and ensure these users don't get future emails from the sender
/// </summary>
/// <param name="text">String for the plain text email body showing what you want the message to look like.</param>
/// <param name="html">String for the HTML email body showing what you want the message to look like.</param>
void EnableUnsubscribe(String text, String html);
/// <summary>
- /// Allow's SendGrid to manage unsubscribes and ensure these users don't get future emails from the sender
+ /// Allow's SendGridMessage to manage unsubscribes and ensure these users don't get future emails from the sender
/// </summary>
/// <param name="replace">Tag in the message body to be replaced with the unsubscribe link and message</param>
void EnableUnsubscribe(String replace);
diff --git a/SendGrid/SendGridMail/Mail.csproj b/SendGrid/SendGridMail/Mail.csproj
index 9d3c35f..89a926c 100644
--- a/SendGrid/SendGridMail/Mail.csproj
+++ b/SendGrid/SendGridMail/Mail.csproj
@@ -8,7 +8,7 @@
<ProjectGuid>{3C687BEF-FF50-44AD-8315-2D4237281AF8}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>SendGridMail</RootNamespace>
+ <RootNamespace>SendGrid</RootNamespace>
<AssemblyName>SendGridMail</AssemblyName>
<FileAlignment>512</FileAlignment>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
@@ -45,8 +45,8 @@
<Reference Include="Microsoft.Threading.Tasks.Extensions.Desktop">
<HintPath>..\packages\Microsoft.Bcl.Async.1.0.16\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll</HintPath>
</Reference>
- <Reference Include="Smtpapi">
- <HintPath>..\packages\smtpapi.1.0.0\lib\Smtpapi.dll</HintPath>
+ <Reference Include="SendGrid.SmtpApi">
+ <HintPath>..\packages\SendGrid.SmtpApi.1.1.3\lib\net40\SendGrid.SmtpApi.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
@@ -76,6 +76,7 @@
<Compile Include="Transport\Web.cs" />
</ItemGroup>
<ItemGroup>
+ <None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
diff --git a/SendGrid/SendGridMail/Properties/AssemblyInfo.cs b/SendGrid/SendGridMail/Properties/AssemblyInfo.cs
index f47a2ad..14f014d 100644
--- a/SendGrid/SendGridMail/Properties/AssemblyInfo.cs
+++ b/SendGrid/SendGridMail/Properties/AssemblyInfo.cs
@@ -7,9 +7,9 @@ using System.Runtime.InteropServices;
// associated with an assembly.
[assembly: AssemblyTitle("SendGridMail")]
-[assembly: AssemblyDescription("A client library for interfacing with the SendGrid API")]
+[assembly: AssemblyDescription("A client library for interfacing with the SendGridMessage API")]
[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("SendGrid")]
+[assembly: AssemblyCompany("SendGridMessage")]
[assembly: AssemblyProduct("SendGridMail")]
[assembly: AssemblyCopyright("Copyright © 2013")]
[assembly: AssemblyTrademark("")]
diff --git a/SendGrid/SendGridMail/SendGrid.cs b/SendGrid/SendGridMail/SendGrid.cs
index 3d2c6e2..09aa1fe 100644
--- a/SendGrid/SendGridMail/SendGrid.cs
+++ b/SendGrid/SendGridMail/SendGrid.cs
@@ -6,11 +6,11 @@ using System.Linq;
using System.Net.Mail;
using System.Net.Mime;
using System.Text.RegularExpressions;
-using Smtpapi;
+using SendGrid.SmtpApi;
-namespace SendGridMail
+namespace SendGrid
{
- public class SendGrid : ISendGrid
+ public class SendGridMessage : ISendGrid
{
#region constants/vars
@@ -25,22 +25,22 @@ namespace SendGridMail
#region Initialization and Constructors
/// <summary>
- /// Creates an instance of SendGrid's custom message object
+ /// Creates an instance of SendGridMessage's custom message object
/// </summary>
/// <returns></returns>
- public SendGrid() : this(new Header())
+ public SendGridMessage() : this(new Header())
{
}
- public SendGrid(IHeader header)
+ public SendGridMessage(IHeader header)
{
_message = new MailMessage();
Header = header;
Headers = new Dictionary<string, string>();
}
- public SendGrid(MailAddress from, MailAddress[] to, MailAddress[] cc, MailAddress[] bcc,
+ public SendGridMessage(MailAddress from, MailAddress[] to, MailAddress[] cc, MailAddress[] bcc,
String subject, String html, String text, IHeader header = null) : this(header)
{
From = from;
@@ -175,53 +175,7 @@ namespace SendGridMail
}
}
- public void AddCc(String address)
- {
- var mailAddress = new MailAddress(address);
- _message.CC.Add(mailAddress);
- }
-
- public void AddCc(IEnumerable<String> addresses)
- {
- if (addresses == null) return;
- foreach (var address in addresses.Where(address => address != null))
- {
- AddCc(address);
- }
- }
-
- public void AddCc(IDictionary<String, IDictionary<String, String>> addresssInfo)
- {
- foreach (var mailAddress in from address in addresssInfo.Keys let table = addresssInfo[address] select new MailAddress(address, table.ContainsKey("DisplayName") ? table["DisplayName"] : null))
- {
- _message.CC.Add(mailAddress);
- }
- }
-
- public void AddBcc(String address)
- {
- var mailAddress = new MailAddress(address);
- _message.Bcc.Add(mailAddress);
- }
-
- public void AddBcc(IEnumerable<String> addresses)
- {
- if (addresses == null) return;
- foreach (var address in addresses.Where(address => address != null))
- {
- AddBcc(address);
- }
- }
-
- public void AddBcc(IDictionary<String, IDictionary<String, String>> addresssInfo)
- {
- foreach (var mailAddress in from address in addresssInfo.Keys let table = addresssInfo[address] select new MailAddress(address, table.ContainsKey("DisplayName") ? table["DisplayName"] : null))
- {
- _message.Bcc.Add(mailAddress);
- }
- }
-
- public Dictionary<String, MemoryStream> StreamedAttachments
+ public Dictionary<String, MemoryStream> StreamedAttachments
{
get { return _streamedAttachments; }
set { _streamedAttachments = value; }
diff --git a/SendGrid/SendGridMail/Transport/ITransport.cs b/SendGrid/SendGridMail/Transport/ITransport.cs
index 99b620c..8de134c 100644
--- a/SendGrid/SendGridMail/Transport/ITransport.cs
+++ b/SendGrid/SendGridMail/Transport/ITransport.cs
@@ -1,4 +1,4 @@
-namespace SendGridMail
+namespace SendGrid
{
/// <summary>
/// Encapsulates the transport mechanism so that it can be used in a generic way,
diff --git a/SendGrid/SendGridMail/Transport/Web.cs b/SendGrid/SendGridMail/Transport/Web.cs
index 7bb8e58..615ac00 100644
--- a/SendGrid/SendGridMail/Transport/Web.cs
+++ b/SendGrid/SendGridMail/Transport/Web.cs
@@ -7,10 +7,10 @@ using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
using System.Xml;
-using Smtpapi;
+using SendGrid.SmtpApi;
// ReSharper disable MemberCanBePrivate.Global
-namespace SendGridMail
+namespace SendGrid
{
public class Web : ITransport
{
@@ -27,7 +27,7 @@ namespace SendGridMail
/// <summary>
/// Creates a new Web interface for sending mail. Preference is using the Factory method.
/// </summary>
- /// <param name="credentials">SendGrid user parameters</param>
+ /// <param name="credentials">SendGridMessage user parameters</param>
/// <param name="https">Use https?</param>
public Web(NetworkCredential credentials)
{
@@ -35,7 +35,7 @@ namespace SendGridMail
}
/// <summary>
- /// Delivers a message over SendGrid's Web interface
+ /// Delivers a message over SendGridMessage's Web interface
/// </summary>
/// <param name="message"></param>
public void Deliver(ISendGrid message)
@@ -53,7 +53,7 @@ namespace SendGridMail
}
/// <summary>
- /// Asynchronously delivers a message over SendGrid's Web interface
+ /// Asynchronously delivers a message over SendGridMessage's Web interface
/// </summary>
/// <param name="message"></param>
public async void DeliverAsync(ISendGrid message)
diff --git a/SendGrid/SendGridMail/packages.config b/SendGrid/SendGridMail/packages.config
index 0470bc3..8ff7b73 100644
--- a/SendGrid/SendGridMail/packages.config
+++ b/SendGrid/SendGridMail/packages.config
@@ -1,9 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
-<packages>
- <package id="Microsoft.Bcl" version="1.0.19" targetFramework="net40" />
- <package id="Microsoft.Bcl.Async" version="1.0.16" targetFramework="net40" />
- <package id="Microsoft.Bcl.Build" version="1.0.10" targetFramework="net40" />
- <package id="Microsoft.Net.Http" version="2.0.20710.0" targetFramework="net45" />
- <package id="smtpapi" version="1.0.0" targetFramework="net40" />
-</packages> \ No newline at end of file
+<dependencies>
+ <group targetFramework="net40">
+ <dependency id="Microsoft.Bcl" version="1.1.6" />
+ <dependency id="Microsoft.Bcl.Build" version="1.0.13" />
+ <dependency id="Microsoft.Net.Http" version="2.2.18" />
+ <dependency id="SendGrid.SmtpApi" version="1.1.3" />
+ </group>
+
+ <group targetFramework="net45">
+ <dependency id="SendGrid.SmtpApi" version="1.1.3" />
+ </group>
+</dependencies> \ No newline at end of file
diff --git a/SendGrid/Tests/TestSendgrid.cs b/SendGrid/Tests/TestSendgrid.cs
index 29b3c7f..0c2a5ec 100644
--- a/SendGrid/Tests/TestSendgrid.cs
+++ b/SendGrid/Tests/TestSendgrid.cs
@@ -3,8 +3,8 @@ using System.Collections.Generic;
using System.IO;
using System.Net.Mail;
using NUnit.Framework;
-using SendGridMail;
-using Smtpapi;
+using SendGrid.SmtpApi;
+using SendGrid;
namespace Tests
{
@@ -14,7 +14,7 @@ namespace Tests
[Test]
public void CreateMimeMessage()
{
- var message = new SendGrid();
+ var message = new SendGridMessage();
var attachment = Path.GetTempFileName();
var text = "this is a test";
var html = "<b>This<\b> is a better test";
@@ -52,7 +52,7 @@ namespace Tests
public void DisableBcc()
{
var header = new Header();
- var sendgrid = new SendGrid(header);
+ var sendgrid = new SendGridMessage(header);
sendgrid.DisableBcc();
@@ -64,7 +64,7 @@ namespace Tests
public void DisableBypassListManagement()
{
var header = new Header();
- var sendgrid = new SendGrid(header);
+ var sendgrid = new SendGridMessage(header);
sendgrid.DisableBypassListManagement();
@@ -76,7 +76,7 @@ namespace Tests
public void DisableClickTracking()
{
var header = new Header();
- var sendgrid = new SendGrid(header);
+ var sendgrid = new SendGridMessage(header);
sendgrid.DisableClickTracking();
@@ -88,7 +88,7 @@ namespace Tests
public void DisableFooter()
{
var header = new Header();
- var sendgrid = new SendGrid(header);
+ var sendgrid = new SendGridMessage(header);
sendgrid.DisableFooter();
@@ -100,7 +100,7 @@ namespace Tests
public void DisableGoogleAnalytics()
{
var header = new Header();
- var sendgrid = new SendGrid(header);
+ var sendgrid = new SendGridMessage(header);
sendgrid.DisableGoogleAnalytics();
@@ -112,7 +112,7 @@ namespace Tests
public void DisableSpamCheck()
{
var header = new Header();
- var sendgrid = new SendGrid(header);
+ var sendgrid = new SendGridMessage(header);
sendgrid.DisableSpamCheck();
@@ -124,7 +124,7 @@ namespace Tests
public void DisableTemplate()
{
var header = new Header();
- var sendgrid = new SendGrid(header);
+ var sendgrid = new SendGridMessage(header);
sendgrid.DisableTemplate();
@@ -136,7 +136,7 @@ namespace Tests
public void DisableUnsubscribe()
{
var header = new Header();
- var sendgrid = new SendGrid(header);
+ var sendgrid = new SendGridMessage(header);
sendgrid.DisableUnsubscribe();
@@ -148,7 +148,7 @@ namespace Tests
public void EnableBcc()
{
var header = new Header();
- var sendgrid = new SendGrid(header);
+ var sendgrid = new SendGridMessage(header);
var email = "somebody@someplace.com";
sendgrid.EnableBcc(email);
@@ -162,7 +162,7 @@ namespace Tests
public void EnableBypassListManagement()
{
var header = new Header();
- var sendgrid = new SendGrid(header);
+ var sendgrid = new SendGridMessage(header);
sendgrid.EnableBypassListManagement();
@@ -174,7 +174,7 @@ namespace Tests
public void EnableClickTracking()
{
var header = new Header();
- var sendgrid = new SendGrid(header);
+ var sendgrid = new SendGridMessage(header);
sendgrid.EnableClickTracking(true);
var json = header.JsonString();
@@ -186,7 +186,7 @@ namespace Tests
public void EnableFooter()
{
var header = new Header();
- var sendgrid = new SendGrid(header);
+ var sendgrid = new SendGridMessage(header);
var text = "My Text";
var html = "<body><p>hello, <% name %></p></body>";
@@ -204,7 +204,7 @@ namespace Tests
public void EnableGoogleAnalytics()
{
var header = new Header();
- var sendgrid = new SendGrid(header);
+ var sendgrid = new SendGridMessage(header);
var source = "SomeDomain.com";
var medium = "Email";
@@ -230,7 +230,7 @@ namespace Tests
public void EnableGravatar()
{
var header = new Header();
- var sendgrid = new SendGrid(header);
+ var sendgrid = new SendGridMessage(header);
sendgrid.EnableGravatar();
@@ -242,7 +242,7 @@ namespace Tests
public void EnableOpenTracking()
{
var header = new Header();
- var sendgrid = new SendGrid(header);
+ var sendgrid = new SendGridMessage(header);
sendgrid.EnableOpenTracking();
@@ -254,7 +254,7 @@ namespace Tests
public void EnableSpamCheck()
{
var header = new Header();
- var sendgrid = new SendGrid(header);
+ var sendgrid = new SendGridMessage(header);
var score = 5;
var url = "http://www.example.com";
@@ -270,7 +270,7 @@ namespace Tests
public void EnableTemplate()
{
var header = new Header();
- var sendgrid = new SendGrid(header);
+ var sendgrid = new SendGridMessage(header);
var html = "<% hadhdhd %>";
var escHtml = "<% hadhdhd %>";
@@ -288,7 +288,7 @@ namespace Tests
public void EnableUnsubscribe()
{
var header = new Header();
- var sendgrid = new SendGrid(header);
+ var sendgrid = new SendGridMessage(header);
var text = "<% %>";
var html = "<% name %>";
@@ -303,7 +303,7 @@ namespace Tests
jsonText + "," + jsonHtml + "}}}}", json);
header = new Header();
- sendgrid = new SendGrid(header);
+ sendgrid = new SendGridMessage(header);
var replace = "John";
var jsonReplace = "\"replace\" : \"" + replace + "\"";
@@ -327,7 +327,7 @@ namespace Tests
public void TestDisableGravatar()
{
var header = new Header();
- var sendgrid = new SendGrid(header);
+ var sendgrid = new SendGridMessage(header);
sendgrid.DisableGravatar();
@@ -339,7 +339,7 @@ namespace Tests
public void TestDisableOpenTracking()
{
var header = new Header();
- var sendgrid = new SendGrid(header);
+ var sendgrid = new SendGridMessage(header);
sendgrid.DisableOpenTracking();
diff --git a/SendGrid/Tests/Tests.csproj b/SendGrid/Tests/Tests.csproj
index 5d52226..40872f4 100644
--- a/SendGrid/Tests/Tests.csproj
+++ b/SendGrid/Tests/Tests.csproj
@@ -57,8 +57,8 @@
<Reference Include="pnunit.framework">
<HintPath>..\packages\NUnit.2.5.10.11092\lib\pnunit.framework.dll</HintPath>
</Reference>
- <Reference Include="Smtpapi">
- <HintPath>..\packages\smtpapi.1.0.0\lib\Smtpapi.dll</HintPath>
+ <Reference Include="SendGrid.SmtpApi">
+ <HintPath>..\packages\SendGrid.SmtpApi.1.1.3\lib\net40\SendGrid.SmtpApi.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
@@ -98,6 +98,7 @@
<Compile Include="Transport\TestWebApi.cs" />
</ItemGroup>
<ItemGroup>
+ <None Include="app.config" />
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
diff --git a/SendGrid/Tests/Transport/TestWebApi.cs b/SendGrid/Tests/Transport/TestWebApi.cs
index 71df619..39aa992 100644
--- a/SendGrid/Tests/Transport/TestWebApi.cs
+++ b/SendGrid/Tests/Transport/TestWebApi.cs
@@ -5,7 +5,7 @@ using System.Net;
using System.Net.Mail;
using Moq;
using NUnit.Framework;
-using SendGridMail;
+using SendGrid;
namespace Tests.Transport
{
@@ -37,8 +37,6 @@ namespace Tests.Transport
{
// Test Variables
const string toAddress = "foobar@outlook.com";
- const string ccAddress = "foo@outlook.com";
- const string bccAddress = "bar@outlook.com";
const string fromAddress = "test@outlook.com";
const string subject = "Test Subject";
const string textBody = "Test Text Body";
@@ -47,10 +45,8 @@ namespace Tests.Transport
var testHeader = new Dictionary<string, string> { { headerKey, "headervalue" } };
const string categoryName = "Example Category";
- var message = new SendGrid();
+ var message = new SendGridMessage();
message.AddTo(toAddress);
- message.AddCc(ccAddress);
- message.AddBcc(bccAddress);
message.From = new MailAddress(fromAddress);
message.Subject = subject;
message.Text = textBody;
@@ -63,8 +59,6 @@ namespace Tests.Transport
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 == bccAddress));
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));
diff --git a/SendGrid/Tests/packages.config b/SendGrid/Tests/packages.config
index 4030718..08ac66b 100644
--- a/SendGrid/Tests/packages.config
+++ b/SendGrid/Tests/packages.config
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Microsoft.Bcl" version="1.1.6" targetFramework="net40" />
- <package id="Microsoft.Bcl.Async" version="1.0.165" targetFramework="net40" />
- <package id="Microsoft.Bcl.Build" version="1.0.13" targetFramework="net40" />
- <package id="Microsoft.Net.Http" version="2.2.18" targetFramework="net40" />
- <package id="NUnit" version="2.5.10.11092" />
- <package id="smtpapi" version="1.0.0" targetFramework="net40" />
+ <package id="Microsoft.Bcl" version="1.1.6" targetFramework="net40" />
+ <package id="Microsoft.Bcl.Async" version="1.0.165" targetFramework="net40" />
+ <package id="Microsoft.Bcl.Build" version="1.0.13" targetFramework="net40" />
+ <package id="Microsoft.Net.Http" version="2.2.18" targetFramework="net40" />
+ <package id="NUnit" version="2.5.10.11092" />
+ <package id="SendGrid.SmtpApi" version="1.1.3" targetFramework="net40" />
</packages> \ No newline at end of file