From 78bff2ce630fd2e2790584bb85165ce7c1f991a2 Mon Sep 17 00:00:00 2001 From: Andrew Pattison Date: Sat, 25 Apr 2015 23:20:12 +0100 Subject: [PATCH] Switched to using Fixie. Added a convention that identifies any class that has a Fact attribute as a test class and that why I removed all but the xUnit core library as that holds the Fact attribute. --- .../InstancePerClassConvention.cs | 20 ++++++++++++++ .../SpecificationTestPatterns.csproj | 13 +++++----- SpecificationTestPatterns/Tests.cs | 26 +++++++------------ SpecificationTestPatterns/packages.config | 4 +-- 4 files changed, 37 insertions(+), 26 deletions(-) create mode 100644 SpecificationTestPatterns/InstancePerClassConvention.cs diff --git a/SpecificationTestPatterns/InstancePerClassConvention.cs b/SpecificationTestPatterns/InstancePerClassConvention.cs new file mode 100644 index 0000000..fb2dbbe --- /dev/null +++ b/SpecificationTestPatterns/InstancePerClassConvention.cs @@ -0,0 +1,20 @@ +namespace SpecificationTestPatterns +{ + using System.Linq; + using Fixie; + using FluentAssertions; + using Xunit; + + public class InstancePerClassConvention : Convention + { + public InstancePerClassConvention() + { + Classes.Where(t => t.Name.StartsWith("When_") && + t.Methods().SelectMany(m => m.GetCustomAttributes(typeof(FactAttribute), false)).Any()); + + Methods.Where(method => method.IsPublic && (method.IsVoid() || method.IsAsync())); + + ClassExecution.CreateInstancePerClass(); + } + } +} \ No newline at end of file diff --git a/SpecificationTestPatterns/SpecificationTestPatterns.csproj b/SpecificationTestPatterns/SpecificationTestPatterns.csproj index af7dbf9..aa3d5c1 100644 --- a/SpecificationTestPatterns/SpecificationTestPatterns.csproj +++ b/SpecificationTestPatterns/SpecificationTestPatterns.csproj @@ -1,6 +1,5 @@  - @@ -13,7 +12,7 @@ SpecificationTestPatterns v4.5.2 512 - 8a22513f + 7460a358 true @@ -33,6 +32,10 @@ 4 + + ..\packages\Fixie.1.0.0.15\lib\net45\Fixie.dll + True + ..\packages\FluentAssertions.3.3.0\lib\net45\FluentAssertions.dll True @@ -60,10 +63,6 @@ ..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll True - - ..\packages\xunit.assert.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.assert.dll - True - ..\packages\xunit.extensibility.core.2.0.0\lib\portable-net45+win+wpa81+wp80+monotouch+monoandroid+Xamarin.iOS\xunit.core.dll True @@ -71,6 +70,7 @@ + @@ -90,7 +90,6 @@ This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. -