diff options
-rw-r--r-- | SendGrid/SendGrid.sln | 23 | ||||
-rw-r--r-- | SendGrid/Tests/Resources/TestApiKeys.cs | 73 | ||||
-rw-r--r-- | SendGrid/Tests/Tests.csproj | 9 | ||||
-rw-r--r-- | SendGrid/Tests/Transport/TestWebApi.cs | 2 | ||||
-rw-r--r-- | SendGrid/Tests/app.config | 5 | ||||
-rw-r--r-- | SendGrid/UnitTest/Properties/AssemblyInfo.cs (renamed from SendGrid/UnitTests/Properties/AssemblyInfo.cs) | 6 | ||||
-rw-r--r-- | SendGrid/UnitTest/UnitTest.cs (renamed from SendGrid/UnitTests/SendGridTests.cs) | 10 | ||||
-rw-r--r-- | SendGrid/UnitTest/UnitTests.csproj (renamed from SendGrid/UnitTests/SendGridTests.csproj) | 9 | ||||
-rw-r--r-- | SendGrid/UnitTest/app.config (renamed from SendGrid/UnitTests/app.config) | 0 | ||||
-rw-r--r-- | SendGrid/UnitTest/packages.config (renamed from SendGrid/UnitTests/packages.config) | 2 |
10 files changed, 43 insertions, 96 deletions
diff --git a/SendGrid/SendGrid.sln b/SendGrid/SendGrid.sln index 8c275f8..3ebc0d8 100644 --- a/SendGrid/SendGrid.sln +++ b/SendGrid/SendGrid.sln @@ -20,6 +20,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mail", "SendGridMail\Mail.c EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SendGrid", "SendGrid\SendGrid.csproj", "{1C318867-440B-4EB9-99E3-C0CC2C556962}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests", "UnitTest\UnitTests.csproj", "{8A66032B-0D1C-4F24-B0E3-A250F31D09D8}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
BuildNet45|Any CPU = BuildNet45|Any CPU
@@ -51,15 +53,12 @@ Global {0319E73A-7039-4858-B047-1EDF88BB6BD1}.Release|x86.ActiveCfg = Release|Any CPU
{F39ADCE7-63B5-406D-9BE8-C407920B6B8F}.BuildNet45|Any CPU.ActiveCfg = BuildNet45|Any CPU
{F39ADCE7-63B5-406D-9BE8-C407920B6B8F}.BuildNet45|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {F39ADCE7-63B5-406D-9BE8-C407920B6B8F}.BuildNet45|Mixed Platforms.Build.0 = Debug|Any CPU
{F39ADCE7-63B5-406D-9BE8-C407920B6B8F}.BuildNet45|x86.ActiveCfg = BuildNet45|Any CPU
{F39ADCE7-63B5-406D-9BE8-C407920B6B8F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F39ADCE7-63B5-406D-9BE8-C407920B6B8F}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {F39ADCE7-63B5-406D-9BE8-C407920B6B8F}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{F39ADCE7-63B5-406D-9BE8-C407920B6B8F}.Debug|x86.ActiveCfg = Debug|Any CPU
{F39ADCE7-63B5-406D-9BE8-C407920B6B8F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F39ADCE7-63B5-406D-9BE8-C407920B6B8F}.Release|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {F39ADCE7-63B5-406D-9BE8-C407920B6B8F}.Release|Mixed Platforms.Build.0 = Debug|Any CPU
{F39ADCE7-63B5-406D-9BE8-C407920B6B8F}.Release|x86.ActiveCfg = Release|Any CPU
{3C687BEF-FF50-44AD-8315-2D4237281AF8}.BuildNet45|Any CPU.ActiveCfg = BuildNet45|Any CPU
{3C687BEF-FF50-44AD-8315-2D4237281AF8}.BuildNet45|Any CPU.Build.0 = BuildNet45|Any CPU
@@ -95,6 +94,24 @@ Global {1C318867-440B-4EB9-99E3-C0CC2C556962}.Release|Mixed Platforms.Build.0 = Debug|Any CPU
{1C318867-440B-4EB9-99E3-C0CC2C556962}.Release|x86.ActiveCfg = Release|Any CPU
{1C318867-440B-4EB9-99E3-C0CC2C556962}.Release|x86.Build.0 = Release|Any CPU
+ {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.BuildNet45|Any CPU.ActiveCfg = Release|Any CPU
+ {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.BuildNet45|Any CPU.Build.0 = Release|Any CPU
+ {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.BuildNet45|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.BuildNet45|Mixed Platforms.Build.0 = Release|Any CPU
+ {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.BuildNet45|x86.ActiveCfg = Release|Any CPU
+ {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.BuildNet45|x86.Build.0 = Release|Any CPU
+ {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.Debug|x86.Build.0 = Debug|Any CPU
+ {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.Release|Any CPU.Build.0 = Release|Any CPU
+ {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.Release|x86.ActiveCfg = Release|Any CPU
+ {8A66032B-0D1C-4F24-B0E3-A250F31D09D8}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/SendGrid/Tests/Resources/TestApiKeys.cs b/SendGrid/Tests/Resources/TestApiKeys.cs deleted file mode 100644 index ee30507..0000000 --- a/SendGrid/Tests/Resources/TestApiKeys.cs +++ /dev/null @@ -1,73 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Net.Mail; -using Moq; -using Newtonsoft.Json.Linq; -using NUnit.Framework; -using SendGrid; - -namespace Tests.Transport -{ - [TestFixture] - internal class TestApiKeys - { - static string _baseUri = "https://api.sendgrid.com/"; - static string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); - public Client client = new Client(_apiKey, _baseUri); - private static string _api_key_id = ""; - - [Test] - public void ApiKeysIntegrationTest() - { - TestGet(); - TestPost(); - TestPatch(); - TestDelete(); - } - - private void TestGet() - { - HttpResponseMessage response = client.ApiKeys.Get(); - Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); - string rawString = response.Content.ReadAsStringAsync().Result; - dynamic jsonObject = JObject.Parse(rawString); - string jsonString = jsonObject.result.ToString(); - Assert.IsNotNull(jsonString); - } - - private void TestPost() - { - HttpResponseMessage response = client.ApiKeys.Post("CSharpTestKey"); - Assert.AreEqual(HttpStatusCode.Created, response.StatusCode); - string rawString = response.Content.ReadAsStringAsync().Result; - dynamic jsonObject = JObject.Parse(rawString); - string api_key = jsonObject.api_key.ToString(); - _api_key_id = jsonObject.api_key_id.ToString(); - string name = jsonObject.name.ToString(); - Assert.IsNotNull(api_key); - Assert.IsNotNull(_api_key_id); - Assert.IsNotNull(name); - } - - private void TestPatch() - { - HttpResponseMessage response = client.ApiKeys.Patch(_api_key_id, "CSharpTestKeyPatched"); - Assert.AreEqual(HttpStatusCode.OK, response.StatusCode); - string rawString = response.Content.ReadAsStringAsync().Result; - dynamic jsonObject = JObject.Parse(rawString); - _api_key_id = jsonObject.api_key_id.ToString(); - string name = jsonObject.name.ToString(); - Assert.IsNotNull(_api_key_id); - Assert.IsNotNull(name); - } - - private void TestDelete() - { - HttpResponseMessage response = client.ApiKeys.Delete(_api_key_id); - Assert.AreEqual(HttpStatusCode.NoContent, response.StatusCode); - } - } -}
\ No newline at end of file diff --git a/SendGrid/Tests/Tests.csproj b/SendGrid/Tests/Tests.csproj index cc57b80..5d6a225 100644 --- a/SendGrid/Tests/Tests.csproj +++ b/SendGrid/Tests/Tests.csproj @@ -50,6 +50,7 @@ </PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
+ <Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Moq">
<HintPath>..\packages\Moq.4.2.1402.2112\lib\net40\Moq.dll</HintPath>
</Reference>
@@ -69,13 +70,14 @@ </ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Resources\TestApiKeys.cs" />
<Compile Include="TestSendgrid.cs" />
<Compile Include="Transport\TestErrorChecker.cs" />
<Compile Include="Transport\TestWebApi.cs" />
</ItemGroup>
<ItemGroup>
- <None Include="app.config" />
+ <None Include="app.config">
+ <SubType>Designer</SubType>
+ </None>
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
@@ -91,6 +93,9 @@ <Name>SendGrid</Name>
</ProjectReference>
</ItemGroup>
+ <ItemGroup>
+ <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
</Project>
\ No newline at end of file diff --git a/SendGrid/Tests/Transport/TestWebApi.cs b/SendGrid/Tests/Transport/TestWebApi.cs index 0c847a9..a06ca69 100644 --- a/SendGrid/Tests/Transport/TestWebApi.cs +++ b/SendGrid/Tests/Transport/TestWebApi.cs @@ -7,7 +7,7 @@ using Moq; using NUnit.Framework;
using SendGrid;
-namespace Tests.Transport
+namespace Transport
{
[TestFixture]
internal class TestWebApi
diff --git a/SendGrid/Tests/app.config b/SendGrid/Tests/app.config index 1696bcc..8047041 100644 --- a/SendGrid/Tests/app.config +++ b/SendGrid/Tests/app.config @@ -16,4 +16,7 @@ </dependentAssembly>
</assemblyBinding>
</runtime>
-<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/></startup></configuration>
+ <startup>
+ <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
+ </startup>
+</configuration>
\ No newline at end of file diff --git a/SendGrid/UnitTests/Properties/AssemblyInfo.cs b/SendGrid/UnitTest/Properties/AssemblyInfo.cs index 74f470d..8eb53f6 100644 --- a/SendGrid/UnitTests/Properties/AssemblyInfo.cs +++ b/SendGrid/UnitTest/Properties/AssemblyInfo.cs @@ -5,11 +5,11 @@ using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("UnitTests")] +[assembly: AssemblyTitle("UnitTest")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("UnitTests")] +[assembly: AssemblyProduct("UnitTest")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -20,7 +20,7 @@ using System.Runtime.InteropServices; [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("2be80f7d-ebb3-47f5-8ccb-b0f634d51849")] +[assembly: Guid("8a66032b-0d1c-4f24-b0e3-a250f31d09d8")] // Version information for an assembly consists of the following four values: // diff --git a/SendGrid/UnitTests/SendGridTests.cs b/SendGrid/UnitTest/UnitTest.cs index a387935..0b5e2bd 100644 --- a/SendGrid/UnitTests/SendGridTests.cs +++ b/SendGrid/UnitTest/UnitTest.cs @@ -5,18 +5,14 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json.Linq; using SendGrid; -namespace SendGridTests +namespace UnitTest { - public class Base + [TestClass] + public class UnitTest { static string _baseUri = "https://api.sendgrid.com/"; static string _apiKey = Environment.GetEnvironmentVariable("SENDGRID_APIKEY", EnvironmentVariableTarget.User); public Client client = new Client(_apiKey, _baseUri); - } - - [TestClass] - public class ApiKeys : Base - { private static string _api_key_id = ""; [TestMethod] diff --git a/SendGrid/UnitTests/SendGridTests.csproj b/SendGrid/UnitTest/UnitTests.csproj index 5eb0337..6539428 100644 --- a/SendGrid/UnitTests/SendGridTests.csproj +++ b/SendGrid/UnitTest/UnitTests.csproj @@ -3,11 +3,11 @@ <PropertyGroup> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> - <ProjectGuid>{2BE80F7D-EBB3-47F5-8CCB-B0F634D51849}</ProjectGuid> + <ProjectGuid>{8A66032B-0D1C-4F24-B0E3-A250F31D09D8}</ProjectGuid> <OutputType>Library</OutputType> <AppDesignerFolder>Properties</AppDesignerFolder> - <RootNamespace>UnitTests</RootNamespace> - <AssemblyName>UnitTests</AssemblyName> + <RootNamespace>UnitTest</RootNamespace> + <AssemblyName>UnitTest</AssemblyName> <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion> <FileAlignment>512</FileAlignment> <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> @@ -41,7 +41,6 @@ <Private>True</Private> </Reference> <Reference Include="System" /> - <Reference Include="System.Net" /> <Reference Include="System.Net.Http" /> </ItemGroup> <Choose> @@ -57,7 +56,7 @@ </Otherwise> </Choose> <ItemGroup> - <Compile Include="SendGridTests.cs" /> + <Compile Include="UnitTest.cs" /> <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> diff --git a/SendGrid/UnitTests/app.config b/SendGrid/UnitTest/app.config index 195db1f..195db1f 100644 --- a/SendGrid/UnitTests/app.config +++ b/SendGrid/UnitTest/app.config diff --git a/SendGrid/UnitTests/packages.config b/SendGrid/UnitTest/packages.config index 505e588..64b5d8e 100644 --- a/SendGrid/UnitTests/packages.config +++ b/SendGrid/UnitTest/packages.config @@ -1,4 +1,4 @@ <?xml version="1.0" encoding="utf-8"?> <packages> - <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net45" /> + <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net452" /> </packages>
\ No newline at end of file |