Skip to content

Commit 611d124

Browse files
committed
Removed approvaltests and mono.cecil
1 parent 8428cc1 commit 611d124

24 files changed

+101
-299
lines changed

TestStack.ConventionTests.Tests/ConventionAssertionClassTests.cs

Lines changed: 0 additions & 41 deletions
This file was deleted.
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
namespace TestStack.ConventionTests.Tests
22
{
33
using System.Linq;
4-
using ApprovalTests.Reporters;
54
using NUnit.Framework;
5+
using Shouldly;
66
using TestAssembly.Collections;
77
using TestStack.ConventionTests.ConventionData;
88
using TestStack.ConventionTests.Reporting;
99
using TestStack.ConventionTests.Tests.TestConventions;
10-
11-
[UseReporter(typeof(DiffReporter))]
10+
1211
public class CsvReportTests
1312
{
1413
[Test]
@@ -17,9 +16,11 @@ public void Can_run_convention_with_simple_reporter()
1716
var typesToVerify = typeof (Leaf).Assembly.GetExportedTypes()
1817
.Where(t => t.Namespace == typeof (Leaf).Namespace);
1918

20-
Convention.IsWithApprovedExeptions(new CollectionsRelationsConvention(),
19+
var failures = Convention.GetFailures(new CollectionsRelationsConvention(),
2120
new Types(typesToVerify, "Entities"),
2221
new CsvReporter());
22+
23+
failures.ShouldMatchApproved();
2324
}
2425
}
2526
}
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
namespace TestStack.ConventionTests.Tests
22
{
3-
using ApprovalTests;
4-
using ApprovalTests.Reporters;
53
using NUnit.Framework;
4+
using Shouldly;
65
using TestAssembly.Controllers;
76
using TestStack.ConventionTests.ConventionData;
87
using TestStack.ConventionTests.Conventions;
98

109
[TestFixture]
11-
[UseReporter(typeof(DiffReporter))]
1210
public class MvcConventions
1311
{
1412
[Test]
@@ -17,8 +15,9 @@ public void controller_conventions()
1715
var types = Types.InAssemblyOf<TestController>();
1816
var convention = new MvcControllerNameAndBaseClassConvention();
1917

20-
var ex = Assert.Throws<ConventionFailedException>(() => Convention.Is(convention, types));
21-
Approvals.Verify(ex.Message);
18+
var failures = Convention.GetFailures(convention, types);
19+
20+
failures.ShouldMatchApproved();
2221
}
2322

2423
[Test]
@@ -27,8 +26,9 @@ public void api_controller_conventions()
2726
var types = Types.InAssemblyOf<TestController>();
2827
var convention = new ApiControllerNamingAndBaseClassConvention();
2928

30-
var ex = Assert.Throws<ConventionFailedException>(() => Convention.Is(convention, types));
31-
Approvals.Verify(ex.Message);
29+
var failures = Convention.GetFailures(convention, types);
30+
31+
failures.ShouldMatchApproved();
3232
}
3333
}
3434
}

TestStack.ConventionTests.Tests/ProjectBasedConventions.cs

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
namespace TestStack.ConventionTests.Tests
22
{
33
using System.Xml.Linq;
4-
using ApprovalTests;
5-
using ApprovalTests.Reporters;
64
using NSubstitute;
75
using NUnit.Framework;
6+
using Shouldly;
87
using TestStack.ConventionTests.ConventionData;
98
using TestStack.ConventionTests.Conventions;
109
using TestStack.ConventionTests.Internal;
1110
using TestStack.ConventionTests.Tests.Properties;
1211

1312
[TestFixture]
14-
[UseReporter(typeof(DiffReporter))]
1513
public class ProjectBasedConventions
1614
{
1715
IProjectProvider projectProvider;
@@ -31,9 +29,9 @@ public void assemblies_referencing_bin_obj()
3129

3230
var projectLocator = Substitute.For<IProjectLocator>();
3331
var project = new ProjectReferences(typeof(ProjectBasedConventions).Assembly, projectProvider, projectLocator);
34-
var ex = Assert.Throws<ConventionFailedException>(() => Convention.Is(new ProjectDoesNotReferenceDllsFromBinOrObjDirectories(), project));
35-
36-
Approvals.Verify(ex.Message);
32+
var failures = Convention.GetFailures(new ProjectDoesNotReferenceDllsFromBinOrObjDirectories(), project);
33+
34+
failures.ShouldMatchApproved();
3735
}
3836

3937
[Test]
@@ -46,7 +44,9 @@ public void assemblies_referencing_bin_obj_with_approved_exceptions()
4644

4745
var projectLocator = Substitute.For<IProjectLocator>();
4846
var project = new ProjectReferences(typeof(ProjectBasedConventions).Assembly, projectProvider, projectLocator);
49-
Convention.IsWithApprovedExeptions(new ProjectDoesNotReferenceDllsFromBinOrObjDirectories(), project);
47+
var failures = Convention.GetFailures(new ProjectDoesNotReferenceDllsFromBinOrObjDirectories(), project);
48+
49+
failures.ShouldMatchApproved();
5050
}
5151

5252
[Test]
@@ -58,9 +58,9 @@ public void scripts_not_embedded_resources()
5858

5959
var projectLocator = Substitute.For<IProjectLocator>();
6060
var project = new ProjectFileItems(typeof (ProjectBasedConventions).Assembly, projectProvider, projectLocator);
61-
var ex = Assert.Throws<ConventionFailedException>(() => Convention.Is(new FilesAreEmbeddedResources(".sql"), project));
61+
var failures = Convention.GetFailures(new FilesAreEmbeddedResources(".sql"), project);
6262

63-
Approvals.Verify(ex.Message);
63+
failures.ShouldMatchApproved();
6464
}
6565

6666
[Test]
@@ -72,7 +72,7 @@ public void scripts_not_embedded_resources_with_approved_exceptions()
7272
.LoadProjectDocument(Arg.Any<string>())
7373
.Returns(XDocument.Parse(Resources.ProjectFileWithInvalidSqlScriptFile));
7474

75-
Convention.IsWithApprovedExeptions(new FilesAreEmbeddedResources(".sql"), project);
75+
Convention.GetFailures(new FilesAreEmbeddedResources(".sql"), project);
7676
}
7777

7878
[Test]
@@ -84,11 +84,9 @@ public void release_debug_type_should_be_pdb_only()
8484

8585
var projectLocator = Substitute.For<IProjectLocator>();
8686
var propertyGroups = new ProjectPropertyGroups(typeof(ProjectBasedConventions).Assembly, projectProvider, projectLocator);
87-
var ex =
88-
Assert.Throws<ConventionFailedException>(
89-
() => Convention.Is(new ConfigurationHasSpecificValue(ConfigurationType.Release, "DebugType", "pdbonly"), propertyGroups));
87+
var failures = Convention.GetFailures(new ConfigurationHasSpecificValue(ConfigurationType.Release, "DebugType", "pdbonly"), propertyGroups);
9088

91-
Approvals.Verify(ex.Message);
89+
failures.ShouldMatchApproved();
9290
}
9391

9492
[Test]
@@ -100,11 +98,9 @@ public void all_configuration_groups_should_have_platform_AnyCPU()
10098

10199
var projectLocator = Substitute.For<IProjectLocator>();
102100
var propertyGroups = new ProjectPropertyGroups(typeof(ProjectBasedConventions).Assembly, projectProvider, projectLocator);
103-
var ex =
104-
Assert.Throws<ConventionFailedException>(
105-
() => Convention.Is(new ConfigurationHasSpecificValue(ConfigurationType.All, "Platform", "AnyCPU"), propertyGroups));
101+
var failures = Convention.GetFailures(new ConfigurationHasSpecificValue(ConfigurationType.All, "Platform", "AnyCPU"), propertyGroups);
106102

107-
Approvals.Verify(ex.Message);
103+
failures.ShouldMatchApproved();
108104
}
109105

110106
[Test]
@@ -116,11 +112,11 @@ public void all_configuration_groups_should_have_optimize_true_if_property_defin
116112

117113
var projectLocator = Substitute.For<IProjectLocator>();
118114
var propertyGroups = new ProjectPropertyGroups(typeof(ProjectBasedConventions).Assembly, projectProvider, projectLocator);
119-
var ex =
120-
Assert.Throws<ConventionFailedException>(
121-
() => Convention.Is(new ConfigurationHasSpecificValue(ConfigurationType.All, "Optimize", "true"), propertyGroups));
115+
var failures =
116+
Convention.GetFailures(new ConfigurationHasSpecificValue(ConfigurationType.All, "Optimize", "true"),
117+
propertyGroups);
122118

123-
Approvals.Verify(ex.Message);
119+
failures.ShouldMatchApproved();
124120
}
125121
}
126122
}

TestStack.ConventionTests.Tests/TestStack.ConventionTests.Tests.csproj

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@
3131
<WarningLevel>4</WarningLevel>
3232
</PropertyGroup>
3333
<ItemGroup>
34-
<Reference Include="ApprovalTests">
35-
<HintPath>..\packages\ApprovalTests.3.0.01\lib\net40\ApprovalTests.dll</HintPath>
36-
</Reference>
37-
<Reference Include="ApprovalUtilities">
38-
<HintPath>..\packages\ApprovalUtilities.3.0.01\lib\net35\ApprovalUtilities.dll</HintPath>
39-
</Reference>
4034
<Reference Include="Autofac">
4135
<HintPath>..\packages\Autofac.3.1.1\lib\net40\Autofac.dll</HintPath>
4236
</Reference>
@@ -46,6 +40,10 @@
4640
<Reference Include="nunit.framework">
4741
<HintPath>..\packages\NUnit.2.6.2\lib\nunit.framework.dll</HintPath>
4842
</Reference>
43+
<Reference Include="Shouldly, Version=2.7.0.0, Culture=neutral, PublicKeyToken=6042cbcb05cbc941, processorArchitecture=MSIL">
44+
<HintPath>..\packages\Shouldly.2.7.0-beta0002\lib\net40\Shouldly.dll</HintPath>
45+
<Private>True</Private>
46+
</Reference>
4947
<Reference Include="System" />
5048
<Reference Include="System.Core" />
5149
<Reference Include="System.Xml.Linq" />
@@ -61,7 +59,6 @@
6159
<Compile Include="Autofac\TestTypes\Foo.cs" />
6260
<Compile Include="Autofac\TestTypes\IBar.cs" />
6361
<Compile Include="Autofac\TestTypes\IFoo.cs" />
64-
<Compile Include="ConventionAssertionClassTests.cs" />
6562
<Compile Include="ConventionData\ProjectPropertyGroupsTests.cs" />
6663
<Compile Include="ConventionFixture.cs" />
6764
<Compile Include="CsvReportTests.cs" />
Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
namespace TestStack.ConventionTests.Tests
22
{
3-
using ApprovalTests;
4-
using ApprovalTests.Reporters;
53
using NUnit.Framework;
4+
using Shouldly;
65
using TestAssembly;
76
using TestStack.ConventionTests.ConventionData;
87
using TestStack.ConventionTests.Conventions;
98

109
[TestFixture]
11-
[UseReporter(typeof (DiffReporter))]
1210
public class TypeBasedConventions
1311
{
1412
readonly Types nhibernateEntities;
@@ -22,29 +20,33 @@ public TypeBasedConventions()
2220
[Test]
2321
public void all_classes_have_default_constructor()
2422
{
25-
var ex = Assert.Throws<ConventionFailedException>(()=>Convention.Is(new AllClassesHaveDefaultConstructor(), nhibernateEntities));
23+
var failures = Convention.GetFailures(new AllClassesHaveDefaultConstructor(), nhibernateEntities);
2624

27-
Approvals.Verify(ex.Message);
25+
failures.ShouldMatchApproved();
2826
}
2927

3028
[Test]
3129
public void all_classes_have_default_constructor_wth_approved_exceptions()
3230
{
33-
Convention.IsWithApprovedExeptions(new AllClassesHaveDefaultConstructor(), nhibernateEntities);
31+
var failures = Convention.GetFailures(new AllClassesHaveDefaultConstructor(), nhibernateEntities);
32+
33+
failures.ShouldMatchApproved();
3434
}
3535

3636
[Test]
3737
public void all_methods_are_virtual()
3838
{
39-
var ex = Assert.Throws<ConventionFailedException>(()=>Convention.Is(new AllMethodsAreVirtual(), nhibernateEntities));
39+
var failures = Convention.GetFailures(new AllMethodsAreVirtual(), nhibernateEntities);
4040

41-
Approvals.Verify(ex.Message);
41+
failures.ShouldMatchApproved();
4242
}
4343

4444
[Test]
4545
public void all_methods_are_virtual_wth_approved_exceptions()
4646
{
47-
Convention.IsWithApprovedExeptions(new AllMethodsAreVirtual(), nhibernateEntities);
47+
var failures = Convention.GetFailures(new AllMethodsAreVirtual(), nhibernateEntities);
48+
49+
failures.ShouldMatchApproved();
4850
}
4951

5052
[Test]
@@ -53,8 +55,9 @@ public void dtos_exists_in_dto_namespace()
5355
var types = Types.InAssemblyOf<SomeDto>();
5456
var convention = new ClassTypeHasSpecificNamespace(t => t.Name.EndsWith("Dto"), "TestAssembly.Dtos", "Dto");
5557

56-
var ex = Assert.Throws<ConventionFailedException>(() =>Convention.Is(convention, types));
57-
Approvals.Verify(ex.Message);
58+
var failures = Convention.GetFailures(convention, types);
59+
60+
failures.ShouldMatchApproved();
5861
}
5962

6063
[Test]
@@ -63,7 +66,7 @@ public void dtos_exists_in_dto_namespace_wth_approved_exceptions()
6366
var types = Types.InAssemblyOf<SomeDto>();
6467
var convention = new ClassTypeHasSpecificNamespace(t => t.Name.EndsWith("Dto"), "TestAssembly.Dtos", "Dto");
6568

66-
Convention.IsWithApprovedExeptions(convention, types);
69+
Convention.GetFailures(convention, types);
6770
}
6871
}
6972
}
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="ApprovalTests" version="3.0.01" targetFramework="net40" />
4-
<package id="ApprovalUtilities" version="3.0.01" targetFramework="net40" />
53
<package id="Autofac" version="3.1.1" targetFramework="net40" />
64
<package id="NSubstitute" version="1.6.1.0" targetFramework="net40" />
75
<package id="NUnit" version="2.6.2" targetFramework="net40" />
6+
<package id="Shouldly" version="2.7.0-beta0002" targetFramework="net40" />
87
</packages>

0 commit comments

Comments
 (0)