Skip to content

Commit e13df80

Browse files
Revert "combine tests"
This reverts commit 86e0b15.
1 parent 86e0b15 commit e13df80

37 files changed

+368
-414
lines changed

Machine.Specifications.Runner.VisualStudio.sln

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.29209.62
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.26228.4
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{405D88EB-F3ED-4B4C-B758-4EA98692F96F}"
77
ProjectSection(SolutionItems) = preProject
@@ -15,6 +15,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Machine.Specifications.Runn
1515
EndProject
1616
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Machine.Specifications.Runner.VisualStudio.Specs", "src\Machine.Specifications.Runner.VisualStudio.Specs\Machine.Specifications.Runner.VisualStudio.Specs.csproj", "{28A8C30C-7C6C-402B-86E2-D54A20748564}"
1717
EndProject
18+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SampleSpecs", "src\SampleSpecs\SampleSpecs.csproj", "{64E9F680-210D-4A69-BF87-13BA3E0FD3B7}"
19+
EndProject
1820
Global
1921
GlobalSection(SolutionConfigurationPlatforms) = preSolution
2022
Debug|Any CPU = Debug|Any CPU
@@ -29,6 +31,10 @@ Global
2931
{28A8C30C-7C6C-402B-86E2-D54A20748564}.Debug|Any CPU.Build.0 = Debug|Any CPU
3032
{28A8C30C-7C6C-402B-86E2-D54A20748564}.Release|Any CPU.ActiveCfg = Release|Any CPU
3133
{28A8C30C-7C6C-402B-86E2-D54A20748564}.Release|Any CPU.Build.0 = Release|Any CPU
34+
{64E9F680-210D-4A69-BF87-13BA3E0FD3B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
35+
{64E9F680-210D-4A69-BF87-13BA3E0FD3B7}.Debug|Any CPU.Build.0 = Debug|Any CPU
36+
{64E9F680-210D-4A69-BF87-13BA3E0FD3B7}.Release|Any CPU.ActiveCfg = Release|Any CPU
37+
{64E9F680-210D-4A69-BF87-13BA3E0FD3B7}.Release|Any CPU.Build.0 = Release|Any CPU
3238
EndGlobalSection
3339
GlobalSection(SolutionProperties) = preSolution
3440
HideSolutionNode = FALSE

src/Machine.Specifications.Runner.VisualStudio.Specs/CompileContext.cs

Lines changed: 0 additions & 81 deletions
This file was deleted.
Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Linq;
23
using Machine.Fakes;
34
using Machine.Specifications;
45
using Machine.VSTestAdapter.Configuration;
@@ -20,36 +21,34 @@ public class When_adapter_runs_tests : WithFakes
2021
</MSpec>
2122
</RunSettings>";
2223

23-
static MSpecTestAdapter adapter;
24+
static MSpecTestAdapter Adapter;
2425

25-
Establish establish = () =>
26-
{
27-
The<IRunSettings>()
28-
.WhenToldTo(runSettings => runSettings.SettingsXml)
29-
.Return(ConfigurationXml);
26+
Establish establish = () => {
27+
The<IRunSettings>().WhenToldTo(runSettings => runSettings.SettingsXml).Return(ConfigurationXml);
28+
The<IRunContext>().WhenToldTo(context => context.RunSettings).Return(The<IRunSettings>());
29+
30+
Adapter = new MSpecTestAdapter(An<ISpecificationDiscoverer>(), The<ISpecificationExecutor>());
31+
};
32+
33+
34+
Because of = () => {
35+
Adapter.RunTests(new[] { "dll" }, The<IRunContext>(), An<IFrameworkHandle>());
36+
};
3037

31-
The<IRunContext>()
32-
.WhenToldTo(context => context.RunSettings)
33-
.Return(The<IRunSettings>());
3438

35-
adapter = new MSpecTestAdapter(An<ISpecificationDiscoverer>(), The<ISpecificationExecutor>());
39+
It should_pick_up_DisableFullTestNameInIDE = () => {
40+
The<ISpecificationExecutor>().WasToldTo(d => d.RunAssembly("dll",
41+
Param<Settings>.Matches(s => s.DisableFullTestNameInIDE == true),
42+
Param<Uri>.IsAnything,
43+
Param<IFrameworkHandle>.IsAnything));
3644
};
3745

38-
Because of = () =>
39-
adapter.RunTests(new[] { "dll" }, The<IRunContext>(), An<IFrameworkHandle>());
40-
41-
It should_pick_up_DisableFullTestNameInIDE = () =>
42-
The<ISpecificationExecutor>()
43-
.WasToldTo(d => d.RunAssembly("dll",
44-
Param<Settings>.Matches(s => s.DisableFullTestNameInIDE),
45-
Param<Uri>.IsAnything,
46-
Param<IFrameworkHandle>.IsAnything));
47-
48-
It should_pick_up_DisableFullTestNameInOutput = () =>
49-
The<ISpecificationExecutor>()
50-
.WasToldTo(d => d.RunAssembly("dll",
51-
Param<Settings>.Matches(s => s.DisableFullTestNameInOutput),
52-
Param<Uri>.IsAnything,
53-
Param<IFrameworkHandle>.IsAnything));
46+
It should_pick_up_DisableFullTestNameInOutput = () => {
47+
The<ISpecificationExecutor>().WasToldTo(d => d.RunAssembly("dll",
48+
Param<Settings>.Matches(s => s.DisableFullTestNameInOutput == true),
49+
Param<Uri>.IsAnything,
50+
Param<IFrameworkHandle>.IsAnything));
51+
};
52+
5453
}
5554
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
using Machine.Specifications;
1+
using System;
2+
using System.Linq;
3+
using Machine.Specifications;
24
using Machine.VSTestAdapter.Configuration;
35

46
namespace Machine.VSTestAdapter.Specs.Configuration
@@ -9,10 +11,13 @@ public class When_parsing_configuration_and_mspec_section_is_missing
911
static Settings Settings;
1012
static string ConfigurationXml = "<RunSettings></RunSettings>";
1113

12-
Because of = () =>
14+
Because of = () => {
1315
Settings = Settings.Parse(ConfigurationXml);
16+
};
1417

15-
It should_default_to_DisplayFullTestName_off = () =>
18+
It should_default_to_DisplayFullTestName_off = () => {
1619
Settings.DisableFullTestNameInOutput.ShouldBeFalse();
20+
};
21+
1722
}
1823
}

src/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/BuiltIn/When_discovering_behaviors.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
namespace Machine.VSTestAdapter.Specs.Discovery.BuiltIn
88
{
9+
10+
11+
912
public class When_discovering_specs_using_behaviors : With_DiscoverySetup<BuiltInSpecificationDiscoverer>
1013
{
1114
It should_pick_up_the_behavior = () => {
@@ -26,4 +29,4 @@ public class When_discovering_specs_using_behaviors : With_DiscoverySetup<BuiltI
2629
discoveredSpec.BehaviorFieldType.ShouldEqual("SampleSpecs.SampleBehavior");
2730
};
2831
}
29-
}
32+
}

src/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/BuiltIn/When_discovering_specs.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
namespace Machine.VSTestAdapter.Specs.Discovery.BuiltIn
88
{
9+
910
public class When_discovering_specs : With_DiscoverySetup<BuiltInSpecificationDiscoverer>
1011
{
1112
It should_find_spec = () => {
@@ -35,4 +36,4 @@ public class When_discovering_specs : With_DiscoverySetup<BuiltInSpecificationDi
3536
discoveredSpec.CodeFilePath.ShouldBeNull();
3637
};
3738
}
38-
}
39+
}

src/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/When_DisableFullTestNameInIDE_is_off.cs

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,26 @@
44
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
55
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter;
66
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;
7+
using SampleSpecs;
78
using System.Reflection;
8-
using Machine.VSTestAdapter.Specs.Fixtures;
99

1010
namespace Machine.VSTestAdapter.Specs.Discovery
1111
{
1212
public class When_DisableFullTestNameInIDE_is_off : WithFakes
1313
{
14-
static CompileContext compiler;
15-
static Assembly assembly;
1614

17-
Establish context = () =>
18-
{
19-
compiler = new CompileContext();
20-
21-
var assemblyPath = compiler.Compile(SampleFixture.Code);
22-
assembly = Assembly.LoadFile(assemblyPath);
15+
Because of = () => {
16+
The<MSpecTestAdapter>().DiscoverTests(new[] { typeof(When_something).GetTypeInfo().Assembly.Location },
17+
An<IDiscoveryContext>(),
18+
An<IMessageLogger>(),
19+
The<ITestCaseDiscoverySink>());
2320
};
2421

25-
Because of = () =>
26-
The<MSpecTestAdapter>()
27-
.DiscoverTests(new[] {assembly.GetType("SampleSpecs.When_something").GetTypeInfo().Assembly.Location},
28-
An<IDiscoveryContext>(),
29-
An<IMessageLogger>(),
30-
The<ITestCaseDiscoverySink>());
31-
3222

33-
It should_use_full_type_and_field_name_for_display_name = () =>
23+
It should_use_full_type_and_field_name_for_display_name = () => {
3424
The<ITestCaseDiscoverySink>()
3525
.WasToldTo(d => d.SendTestCase(Param<TestCase>.Matches(t => t.DisplayName.Equals("When something it should pass", StringComparison.Ordinal))))
3626
.OnlyOnce();
27+
};
3728
}
3829
}

src/Machine.Specifications.Runner.VisualStudio.Specs/Discovery/When_DisableFullTestNameInIDE_is_on.cs

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
using System;
2+
using System.Linq;
23
using Machine.Fakes;
34
using Machine.Specifications;
45
using Machine.VSTestAdapter.Helpers;
56
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
67
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter;
78
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;
9+
using SampleSpecs;
810
using System.Reflection;
9-
using Machine.VSTestAdapter.Specs.Fixtures;
1011

1112
namespace Machine.VSTestAdapter.Specs.Discovery
1213
{
1314
public class When_DisableFullTestNameInIDE_is_on : WithFakes
1415
{
15-
const string ConfigurationXml = @"<RunSettings>
16+
static string ConfigurationXml = @"<RunSettings>
1617
<RunConfiguration>
1718
<MaxCpuCount>0</MaxCpuCount>
1819
</RunConfiguration>
@@ -21,43 +22,26 @@ public class When_DisableFullTestNameInIDE_is_on : WithFakes
2122
</MSpec>
2223
</RunSettings>";
2324

24-
static CompileContext compiler;
25-
static Assembly assembly;
26-
27-
Establish context = () =>
28-
{
29-
compiler = new CompileContext();
30-
31-
var assemblyPath = compiler.Compile(SampleFixture.Code);
32-
assembly = Assembly.LoadFile(assemblyPath);
25+
Establish establish = () => {
26+
The<IRunSettings>().WhenToldTo(runSettings => runSettings.SettingsXml).Return(ConfigurationXml);
27+
The<IDiscoveryContext>().WhenToldTo(context => context.RunSettings).Return(The<IRunSettings>());
3328
};
3429

35-
Establish establish = () =>
36-
{
37-
The<IRunSettings>()
38-
.WhenToldTo(runSettings => runSettings.SettingsXml)
39-
.Return(ConfigurationXml);
4030

41-
The<IDiscoveryContext>()
42-
.WhenToldTo(context => context.RunSettings)
43-
.Return(The<IRunSettings>());
31+
Because of = () => {
32+
The<MSpecTestAdapter>().DiscoverTests(new[] { typeof(StandardSpec).GetTypeInfo().Assembly.Location },
33+
The<IDiscoveryContext>(),
34+
An<IMessageLogger>(),
35+
The<ITestCaseDiscoverySink>());
4436
};
4537

46-
Because of = () =>
47-
The<MSpecTestAdapter>().DiscoverTests(new[] {assembly.GetType("SampleSpecs.StandardSpec").GetTypeInfo().Assembly.Location},
48-
The<IDiscoveryContext>(),
49-
An<IMessageLogger>(),
50-
The<ITestCaseDiscoverySink>());
51-
5238

53-
It should_use_test_name_as_display_name = () =>
54-
{
39+
It should_use_test_name_as_display_name = () => {
5540
var specId = new VisualStudioTestIdentifier("SampleSpecs.StandardSpec", "should_pass");
5641

5742
The<ITestCaseDiscoverySink>()
58-
.WasToldTo(d => d.SendTestCase(Param<TestCase>.Matches(t =>
59-
t.ToVisualStudioTestIdentifier().Equals(specId) &&
60-
t.DisplayName.Equals("should pass", StringComparison.Ordinal))))
43+
.WasToldTo(d => d.SendTestCase(Param<TestCase>.Matches(t => t.ToVisualStudioTestIdentifier().Equals(specId) &&
44+
t.DisplayName.Equals("should pass", StringComparison.Ordinal))))
6145
.OnlyOnce();
6246
};
6347
}

0 commit comments

Comments
 (0)