From 5822189357248d782ffb8fa8fce052ab55c78456 Mon Sep 17 00:00:00 2001 From: Stuart Grassie Date: Mon, 24 Jun 2013 22:42:38 +0100 Subject: [PATCH 1/4] Started to kill MSTest I was pleased to get a contribution, but I'm now mad with myself for not being more forceful in not allowing MSTest to creep into my project. Kill it with fire. --- .../Ext/TinySpec.cs | 15 ++------- .../GitHubAPI.IntegrationTests.csproj | 1 - .../UsersTest.cs | 31 ++++++------------- 3 files changed, 12 insertions(+), 35 deletions(-) diff --git a/csharp-github-api.IntegrationTests/Ext/TinySpec.cs b/csharp-github-api.IntegrationTests/Ext/TinySpec.cs index 667ea4f..bfbeda3 100644 --- a/csharp-github-api.IntegrationTests/Ext/TinySpec.cs +++ b/csharp-github-api.IntegrationTests/Ext/TinySpec.cs @@ -16,17 +16,7 @@ // specific language governing permissions and limitations under the License. // ============================================================================== -#if NUNIT using NUnit.Framework; -#else -using TestFixture = Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute; -using Test = Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute; -using TestFixtureSetUp = Microsoft.VisualStudio.TestTools.UnitTesting.TestInitializeAttribute; -using TestFixtureTearDown = Microsoft.VisualStudio.TestTools.UnitTesting.TestCleanupAttribute; -using SetUp = Microsoft.VisualStudio.TestTools.UnitTesting.TestInitializeAttribute; -using Microsoft.VisualStudio.TestTools.UnitTesting; -#endif - using System; namespace GitHubAPI.IntegrationTests.Ext @@ -55,9 +45,8 @@ public void TearDown() public virtual void AfterObservations() {} } - //Note: Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute which is what ths should inherit from in VS testing is sealeds - public class ObservationAttribute : NUnit.Framework.TestAttribute {} - public class FactAttribute : NUnit.Framework.TestAttribute { } + public class ObservationAttribute : TestAttribute {} + public class FactAttribute : TestAttribute { } public class ConcernForAttribute : Attribute { diff --git a/csharp-github-api.IntegrationTests/GitHubAPI.IntegrationTests.csproj b/csharp-github-api.IntegrationTests/GitHubAPI.IntegrationTests.csproj index 617fac2..4277052 100644 --- a/csharp-github-api.IntegrationTests/GitHubAPI.IntegrationTests.csproj +++ b/csharp-github-api.IntegrationTests/GitHubAPI.IntegrationTests.csproj @@ -51,7 +51,6 @@ ..\packages\log4net.1.2.10\lib\2.0\log4net.dll - ..\packages\NUnit.2.6.2\lib\nunit.framework.dll diff --git a/csharp-github-api.IntegrationTests/UsersTest.cs b/csharp-github-api.IntegrationTests/UsersTest.cs index c56716a..60ae2f4 100644 --- a/csharp-github-api.IntegrationTests/UsersTest.cs +++ b/csharp-github-api.IntegrationTests/UsersTest.cs @@ -1,26 +1,16 @@ -#if NUNIT -using NUnit.Framework; -#else -using TestFixture = Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute; -using Test = Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute; -using Fact = Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute; -using TestFixtureSetUp = Microsoft.VisualStudio.TestTools.UnitTesting.TestInitializeAttribute; -using SetUp = Microsoft.VisualStudio.TestTools.UnitTesting.TestInitializeAttribute; -using Microsoft.VisualStudio.TestTools.UnitTesting; -#endif - -using GitHubAPI.Api.Users; -using GitHubAPI.Models; -using FluentAssertions; -using System.Collections.Generic; - namespace GitHubAPI.IntegrationTests { - [TestFixture] + using NUnit.Framework; + + using GitHubAPI.Api.Users; + using GitHubAPI.Models; + using GitHubAPI.IntegrationTests.Ext; + using FluentAssertions; + using System.Collections.Generic; + public class UsersTest { - - public abstract class UsersTestsBase : GitHubAPI.IntegrationTests.Ext.TestsSpecBase + public abstract class UsersTestsBase : TestsSpecBase { protected GithubRestApiClient Github; @@ -34,7 +24,6 @@ public override void Context() } //You have to annotation each test class individually, i bet this is because TestClassAttribute isn't marked for inheritence while TestFixture is - [TestFixture] public class when_retrieving_unauthenticated_user : UsersTestsBase { public override void Because() @@ -55,7 +44,7 @@ public void then_response_dynamic_should_have_login_property_with_expected_user( { var response = Github.GetUser(Username); - NUnit.Framework.Assert.That(response.Dynamic().login, NUnit.Framework.Is.StringMatching(User)); + Assert.That(response.Dynamic().login, Is.StringMatching(User)); } [Fact] From 0b46939071c31988bc9c7b1266fc463409ec5627 Mon Sep 17 00:00:00 2001 From: Stuart Grassie Date: Mon, 24 Jun 2013 23:15:11 +0100 Subject: [PATCH 2/4] MSTest = dead. Changed the test config stuff again Right. MSTest is completely dead, its poison will not darken our doors again. Changed the config back for secrets. It's nice and simple like this and I like it it just how it is thank you very much. --- .gitignore | 2 +- GitHubAPI.Net.sln | 4 +- .../Authentication/BasicAuthenticationTest.cs | 23 ++----- .../GitHubAPI.IntegrationTests.csproj | 4 +- ...ubAPI.IntegrationTests.dll.config.example} | 0 .../HeaderProviderTests.cs | 26 ++------ .../IssueTests.cs | 61 ++++--------------- csharp-github-api.Tests/CastleTest.cs | 23 ++----- ...ts.NUnit.csproj => GitHubAPI.Tests.csproj} | 1 - csharp-github-api.Tests/MiscTests.cs | 26 ++------ .../Properties/AssemblyInfo.cs | 4 +- .../RestRequestFactoryTests.cs | 31 +++------- 12 files changed, 49 insertions(+), 156 deletions(-) rename csharp-github-api.IntegrationTests/{csharp-github-api.IntegrationTests.dll.config.example => GitHubAPI.IntegrationTests.dll.config.example} (100%) rename csharp-github-api.Tests/{GitHubAPI.Tests.NUnit.csproj => GitHubAPI.Tests.csproj} (95%) diff --git a/.gitignore b/.gitignore index 5ac86e6..2191290 100644 --- a/.gitignore +++ b/.gitignore @@ -150,5 +150,5 @@ $RECYCLE.BIN/ #Ignore settings -csharp-github-api.IntegrationTests.dll.config +GitHubAPI.IntegrationTests.dll.config App.config diff --git a/GitHubAPI.Net.sln b/GitHubAPI.Net.sln index 099f6b9..5ea269b 100644 --- a/GitHubAPI.Net.sln +++ b/GitHubAPI.Net.sln @@ -1,9 +1,9 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Express 2012 for Web +# Visual Studio 2012 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitHubAPI", "csharp-github-api\GitHubAPI.csproj", "{AC8795CC-BDFF-4D37-85EE-E17A7D5A8A59}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitHubAPI.Tests.NUnit", "csharp-github-api.Tests\GitHubAPI.Tests.NUnit.csproj", "{16450E56-7802-4E7B-9F01-6A4824175B15}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitHubAPI.Tests", "csharp-github-api.Tests\GitHubAPI.Tests.csproj", "{16450E56-7802-4E7B-9F01-6A4824175B15}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GitHubAPI.IntegrationTests", "csharp-github-api.IntegrationTests\GitHubAPI.IntegrationTests.csproj", "{77E78A72-17B3-436F-8F26-B2910F3101DE}" EndProject diff --git a/csharp-github-api.IntegrationTests/Authentication/BasicAuthenticationTest.cs b/csharp-github-api.IntegrationTests/Authentication/BasicAuthenticationTest.cs index 402bfb4..d60350d 100644 --- a/csharp-github-api.IntegrationTests/Authentication/BasicAuthenticationTest.cs +++ b/csharp-github-api.IntegrationTests/Authentication/BasicAuthenticationTest.cs @@ -1,21 +1,10 @@ -#if NUNIT -using NUnit.Framework; -#else -using TestFixture = Microsoft.VisualStudio.TestTools.UnitTesting.TestClassAttribute; -using Test = Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute; -using TestFixtureSetUp = Microsoft.VisualStudio.TestTools.UnitTesting.TestInitializeAttribute; -using SetUp = Microsoft.VisualStudio.TestTools.UnitTesting.TestInitializeAttribute; -using Microsoft.VisualStudio.TestTools.UnitTesting; -#endif - - -using System.Configuration; +namespace GitHubAPI.IntegrationTests.Authentication +{ + using NUnit.Framework; + using System.Configuration; -using RestSharp; -using StructureMap; + using RestSharp; -namespace GitHubAPI.IntegrationTests.Authentication -{ [TestFixture] public class BasicAuthenticationTest { @@ -47,7 +36,7 @@ public void MakeAuthenticatedRequest() var response = client.Execute(_restRequest); - NUnit.Framework.Assert.That(response.Content, NUnit.Framework.Is.StringContaining("total_private_repos")); + Assert.That(response.Content, Is.StringContaining("total_private_repos")); } } } diff --git a/csharp-github-api.IntegrationTests/GitHubAPI.IntegrationTests.csproj b/csharp-github-api.IntegrationTests/GitHubAPI.IntegrationTests.csproj index 4277052..d6f5624 100644 --- a/csharp-github-api.IntegrationTests/GitHubAPI.IntegrationTests.csproj +++ b/csharp-github-api.IntegrationTests/GitHubAPI.IntegrationTests.csproj @@ -112,14 +112,12 @@ ResXFileCodeGenerator TestResources.Designer.cs - - - + copy $(ProjectDir)GitHubAPI.IntegrationTests.dll.config $(ProjectDir)$(OutDir)