From ea3c83f83d9bde9fdb562994d6aab858d8fabb34 Mon Sep 17 00:00:00 2001 From: CJ Buchmann Date: Fri, 6 Jan 2012 16:12:26 -0800 Subject: [PATCH 1/2] initial unit tests for header --- SendGrid/SendGrid/Header.cs | 56 +++++++ SendGrid/SendGrid/SendGrid.cs | 301 ++++++++++++++++++++++++++++++++++ SendGrid/Tests/TestHeader.cs | 25 +++ 3 files changed, 382 insertions(+) create mode 100755 SendGrid/SendGrid/Header.cs create mode 100755 SendGrid/SendGrid/SendGrid.cs create mode 100755 SendGrid/Tests/TestHeader.cs diff --git a/SendGrid/SendGrid/Header.cs b/SendGrid/SendGrid/Header.cs new file mode 100755 index 000000000..42a538f19 --- /dev/null +++ b/SendGrid/SendGrid/Header.cs @@ -0,0 +1,56 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Mail; +using System.Text; + +namespace SendGrid +{ + public class Header : IHeader + { + public void AddTo(IEnumerable recipients) + { + throw new NotImplementedException(); + } + + public void AddSubVal(string tag, IEnumerable substitutions) + { + throw new NotImplementedException(); + } + + public void AddUniqueIdentifier(IDictionary identifiers) + { + throw new NotImplementedException(); + } + + public void SetCategory(string category) + { + throw new NotImplementedException(); + } + + public void Enable(string filter) + { + throw new NotImplementedException(); + } + + public void Disable(string filter) + { + throw new NotImplementedException(); + } + + public void AddFilterSetting(string filter, IEnumerable settings, string value) + { + throw new NotImplementedException(); + } + + public void AddHeader(MailMessage mime) + { + throw new NotImplementedException(); + } + + public void AsJson() + { + throw new NotImplementedException(); + } + } +} diff --git a/SendGrid/SendGrid/SendGrid.cs b/SendGrid/SendGrid/SendGrid.cs new file mode 100755 index 000000000..966dc6df7 --- /dev/null +++ b/SendGrid/SendGrid/SendGrid.cs @@ -0,0 +1,301 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Mail; +using System.Text; + +namespace SendGrid +{ + public class SendGrid : ISendGrid + { + public SendGrid(IHeader header) + { + throw new NotImplementedException(); + } + + public string From + { + get { throw new NotImplementedException(); } + set { throw new NotImplementedException(); } + } + + public string To + { + get { throw new NotImplementedException(); } + set { throw new NotImplementedException(); } + } + + public string Cc + { + get { throw new NotImplementedException(); } + set { throw new NotImplementedException(); } + } + + public string Bcc + { + get { throw new NotImplementedException(); } + set { throw new NotImplementedException(); } + } + + public string Subject + { + get { throw new NotImplementedException(); } + set { throw new NotImplementedException(); } + } + + public IHeader Header + { + get { throw new NotImplementedException(); } + set { throw new NotImplementedException(); } + } + + public string Html + { + get { throw new NotImplementedException(); } + set { throw new NotImplementedException(); } + } + + public string Text + { + get { throw new NotImplementedException(); } + set { throw new NotImplementedException(); } + } + + public string Transport + { + get { throw new NotImplementedException(); } + set { throw new NotImplementedException(); } + } + + public string Date + { + get { throw new NotImplementedException(); } + set { throw new NotImplementedException(); } + } + + public MailMessage CreateMimeMessage() + { + throw new NotImplementedException(); + } + + public void AddTo(string address) + { + throw new NotImplementedException(); + } + + public void AddTo(IEnumerable addresses) + { + throw new NotImplementedException(); + } + + public void AddTo(IDictionary addresssInfo) + { + throw new NotImplementedException(); + } + + public void AddTo(IEnumerable> addressesInfo) + { + throw new NotImplementedException(); + } + + public void AddCc(string address) + { + throw new NotImplementedException(); + } + + public void AddCc(IEnumerable addresses) + { + throw new NotImplementedException(); + } + + public void AddCc(IDictionary addresssInfo) + { + throw new NotImplementedException(); + } + + public void AddCc(IEnumerable> addressesInfo) + { + throw new NotImplementedException(); + } + + public void AddBcc(string address) + { + throw new NotImplementedException(); + } + + public void AddBcc(IEnumerable addresses) + { + throw new NotImplementedException(); + } + + public void AddBcc(IDictionary addresssInfo) + { + throw new NotImplementedException(); + } + + public void AddBcc(IEnumerable> addressesInfo) + { + throw new NotImplementedException(); + } + + public void AddRcpts(string address) + { + throw new NotImplementedException(); + } + + public void AddRcpts(IEnumerable addresses) + { + throw new NotImplementedException(); + } + + public void AddRcpts(IDictionary addresssInfo) + { + throw new NotImplementedException(); + } + + public void AddRcpts(IEnumerable> addressesInfo) + { + throw new NotImplementedException(); + } + + public void AddSubVal(string tag, string value) + { + throw new NotImplementedException(); + } + + public void AddAttachment(string filePath) + { + throw new NotImplementedException(); + } + + public void AddAttachment(Attachment attachment) + { + throw new NotImplementedException(); + } + + public string GetMailFrom() + { + throw new NotImplementedException(); + } + + public IEnumerable GetRecipients() + { + throw new NotImplementedException(); + } + + public string Get(string field) + { + throw new NotImplementedException(); + } + + public void Set(string field, string value) + { + throw new NotImplementedException(); + } + + public void DisableGravatar() + { + throw new NotImplementedException(); + } + + public void DisableOpenTracking() + { + throw new NotImplementedException(); + } + + public void DisableClickTracking() + { + throw new NotImplementedException(); + } + + public void DisableSpamCheck() + { + throw new NotImplementedException(); + } + + public void DisableUnsubscribe() + { + throw new NotImplementedException(); + } + + public void DisableFooter() + { + throw new NotImplementedException(); + } + + public void DisableGoogleAnalytics() + { + throw new NotImplementedException(); + } + + public void DisableTemplate() + { + throw new NotImplementedException(); + } + + public void DisableBcc() + { + throw new NotImplementedException(); + } + + public void DisableBipassListManaement() + { + throw new NotImplementedException(); + } + + public void EnableGravatar() + { + throw new NotImplementedException(); + } + + public void EnableOpenTracking() + { + throw new NotImplementedException(); + } + + public void EnableClickTracking(string text = null) + { + throw new NotImplementedException(); + } + + public void EnableSpamCheck(int score = 5, string url = null) + { + throw new NotImplementedException(); + } + + public void EnableUnsubscribe(string text, string html, string replace, string url, string landing) + { + throw new NotImplementedException(); + } + + public void EnableFooter(string text = null, string html = null) + { + throw new NotImplementedException(); + } + + public void EnableGoogleAnalytics(string source, string medium, string term, string content = null, string campaign = null) + { + throw new NotImplementedException(); + } + + public void EnableTemplate(string html = null) + { + throw new NotImplementedException(); + } + + public void EnableBcc(string email = null) + { + throw new NotImplementedException(); + } + + public void EnableBipassListManaement() + { + throw new NotImplementedException(); + } + + public void Mail() + { + throw new NotImplementedException(); + } + } +} diff --git a/SendGrid/Tests/TestHeader.cs b/SendGrid/Tests/TestHeader.cs new file mode 100755 index 000000000..323e394a4 --- /dev/null +++ b/SendGrid/Tests/TestHeader.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Moq; +using NUnit.Framework; +using SendGrid; + +namespace Tests +{ + [TestFixture] + public class TestHeader + { + [Test] + public void TestAddTo() + { + var foo = new Mock(); + foo.Setup(m => m.Enable("foo")); + + var bar = new SendGrid.SendGrid(foo.Object); + Assert.AreEqual(1, 2, "I suck"); + + } + } +} From 86fbabd1c005bd72bc587887116a4391329d0e5b Mon Sep 17 00:00:00 2001 From: CJ Buchmann Date: Fri, 6 Jan 2012 16:17:57 -0800 Subject: [PATCH 2/2] Modified Isendgrid to add new header object, and removed erroneous dependencies from files --- SendGrid/SendGrid.suo | Bin 34816 -> 39936 bytes SendGrid/SendGrid/ISendGrid.cs | 4 +--- SendGrid/SendGrid/Mail.csproj | 2 ++ SendGrid/SendGrid/Transport/ITransport.cs | 7 +------ SendGrid/Tests/Tests.csproj | 7 +++++++ 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/SendGrid/SendGrid.suo b/SendGrid/SendGrid.suo index 9a82799e9d48c8fd3a0e0e38ab9d0b30b43a9a4c..1b103bc2e47696c218e5e834b59c8c94f61552a3 100755 GIT binary patch literal 39936 zcmeHQeUMw#b$@GYY-1o00|Dbug#dA2rAWKlmDV2weXVWcwHNPtp+R74wQtvAwbCMK z{eeyE1e%i2e7OXOaVU_qNmFPD0Zhr4A(XT!iAkoNVJ7J$ZD*RcGo2<){>Tgk_xHQ^ z-PP06*OOM>m1JMd(fhi3_ndprJ?GqW&%Jv6#D%|j{Oha!MYE*qwX?LhPcGNaHr?;Q zIYFcgG;I-12ydS}c~aigG@PDEEmQ+<0oNsHJP%+ofbG2uuoQ3(U^(DCzzV>*fOi1S z2cY@23jyy0Tm)DN2mmeybOPQ5xD;?1U=`qUz-qv|0apNi58wd22XH0ey@0C#R|BpA zybrJj@P5Fxfa?I=04Kl&_yE8S=mL=cZottC=mGQsd;mY753m-n4zM1u0dPHFBY?jP z;`l*82oMHD0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8=iz&86=B|+JeS+;{QSui!XYnE48wdqJk*te z!1M5&cWN^c&O?IHizb*&HuNGj5Cl*{d0{T1pr~ zz=m`VepEa7sC=Hrsv1E^hBq}wNDtiAq&oe$9zdc3XK;KQ=`7M<3>%J(lz$%Qqex>& z0VGG)cU8B3TXbE>4&IRuu>v${1*Ka1h~-cln#|i_s;CYQ7TXCA4-%`wx`zowjd}%0 zbgL>IPD1d9?ltWOoM~b(Nr5vjjj8pxY+zwJ=>XhLsZ=VH=Lkr}HVEjAt0)uZ67kIR zcI|1@=b32|ZnY_a4GxmP42v8O+xz#+uz}&RpJek7EP_)S$}*LW-Ke`npV~lH0Gs8Wn3#*uQG1^DkbSD))MvK z5MxXgHA6+M7Je4>s*6ATGLZ{2mKnHL)Bc}fP_3V8E8t!0Gx$?Zgch@j=5qM(3D7m_ zmCjw4S*~-%LmlM3(Fmtr(R04PvGCz)cv@GkU(gp+j~n2(C=mskh({1>^lLikv!f=^q;7nFW{ZAaHln{N}CZ5QDE4lf9KI?$ac zB_GD#lM|r7q$b!~e5nxZ8ila+3vh-_N~yy@KM|a`WRYVCc!hVkI~jDhn8DwBy<&8iba?R3i#yf?u`csTn`pOTe0*PQ%$^= diff --git a/SendGrid/SendGrid/ISendGrid.cs b/SendGrid/SendGrid/ISendGrid.cs index e5d32266f..20e7114cf 100755 --- a/SendGrid/SendGrid/ISendGrid.cs +++ b/SendGrid/SendGrid/ISendGrid.cs @@ -14,7 +14,7 @@ public interface ISendGrid String Cc { get; set; } String Bcc { get; set; } String Subject { get; set; } - String Headers { get; set; } + IHeader Header { get; set; } String Html { get; set; } String Text { get; set; } String Transport { get; set; } @@ -59,8 +59,6 @@ public interface ISendGrid #endregion #region SMTP API Functions - IHeader Header(); - void DisableGravatar(); void DisableOpenTracking(); void DisableClickTracking(); diff --git a/SendGrid/SendGrid/Mail.csproj b/SendGrid/SendGrid/Mail.csproj index 141d23258..d6b0d5523 100755 --- a/SendGrid/SendGrid/Mail.csproj +++ b/SendGrid/SendGrid/Mail.csproj @@ -41,9 +41,11 @@ + + diff --git a/SendGrid/SendGrid/Transport/ITransport.cs b/SendGrid/SendGrid/Transport/ITransport.cs index 97ebdb6b7..92557b1e9 100755 --- a/SendGrid/SendGrid/Transport/ITransport.cs +++ b/SendGrid/SendGrid/Transport/ITransport.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace SendGrid.Transport +namespace SendGrid.Transport { public interface ITransport { diff --git a/SendGrid/Tests/Tests.csproj b/SendGrid/Tests/Tests.csproj index 5f8d4025d..0fcdc8622 100755 --- a/SendGrid/Tests/Tests.csproj +++ b/SendGrid/Tests/Tests.csproj @@ -52,11 +52,18 @@ + + + + {3C687BEF-FF50-44AD-8315-2D4237281AF8} + Mail + +