Skip to content

Commit b6afda8

Browse files
committed
Merge pull request #53 from ivanz/feature/rc1
Feature/rc1
2 parents 30be48c + 9087a92 commit b6afda8

20 files changed

+169
-62
lines changed

Source/Machine.VSTestAdapter.Specs/Configuration/When_adapter_runs_tests.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99

1010
namespace Machine.VSTestAdapter.Specs.Configuration
1111
{
12-
[Subject(typeof(Settings), "Configuration")]
1312
public class When_adapter_runs_tests : WithFakes
1413
{
1514
static string ConfigurationXml = @"<RunSettings>
1615
<RunConfiguration>
1716
<MaxCpuCount>0</MaxCpuCount>
1817
</RunConfiguration>
1918
<MSpec>
20-
<DisplayFullTestNameInOutput>true</DisplayFullTestNameInOutput>
19+
<DisableFullTestNameInIDE>true</DisableFullTestNameInIDE>
20+
<DisableFullTestNameInOutput>true</DisableFullTestNameInOutput>
2121
</MSpec>
2222
</RunSettings>";
2323

@@ -36,9 +36,16 @@ public class When_adapter_runs_tests : WithFakes
3636
};
3737

3838

39-
It should_pick_up_DisplayFullTestName = () => {
39+
It should_pick_up_DisableFullTestNameInIDE = () => {
4040
The<ISpecificationExecutor>().WasToldTo(d => d.RunAssembly("dll",
41-
Param<Settings>.Matches(s => s.DisplayFullTestNameInOutput == true),
41+
Param<Settings>.Matches(s => s.DisableFullTestNameInIDE == true),
42+
Param<Uri>.IsAnything,
43+
Param<IFrameworkHandle>.IsAnything));
44+
};
45+
46+
It should_pick_up_DisableFullTestNameInOutput = () => {
47+
The<ISpecificationExecutor>().WasToldTo(d => d.RunAssembly("dll",
48+
Param<Settings>.Matches(s => s.DisableFullTestNameInOutput == true),
4249
Param<Uri>.IsAnything,
4350
Param<IFrameworkHandle>.IsAnything));
4451
};

Source/Machine.VSTestAdapter.Specs/Configuration/When_parsing_configuration_and_mspec_section_is_missing.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class When_parsing_configuration_and_mspec_section_is_missing
1616
};
1717

1818
It should_default_to_DisplayFullTestName_off = () => {
19-
Settings.DisplayFullTestNameInOutput.ShouldBeFalse();
19+
Settings.DisableFullTestNameInOutput.ShouldBeFalse();
2020
};
2121

2222
}

Source/Machine.VSTestAdapter.Specs/Configuration/When_parsing_valid_configuration.cs

Lines changed: 0 additions & 28 deletions
This file was deleted.

Source/Machine.VSTestAdapter.Specs/Discovery/BuiltIn/When_discovering_specs.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ public class When_discovering_specs : With_DiscoverySetup<BuiltInSpecificationDi
1414
"StandardSpec".Equals(x.ClassName, StringComparison.Ordinal));
1515
discoveredSpec.ShouldNotBeNull();
1616

17-
discoveredSpec.SpecificationDisplayName.ShouldEqual("should pass");
1817
discoveredSpec.LineNumber.ShouldEqual(14);
1918
discoveredSpec.CodeFilePath.EndsWith("StandardSpec.cs", StringComparison.Ordinal);
2019
};
@@ -24,7 +23,6 @@ public class When_discovering_specs : With_DiscoverySetup<BuiltInSpecificationDi
2423
"StandardSpec".Equals(x.ClassName, StringComparison.Ordinal));
2524
discoveredSpec.ShouldNotBeNull();
2625

27-
discoveredSpec.SpecificationDisplayName.ShouldEqual("should be ignored");
2826
discoveredSpec.LineNumber.ShouldEqual(20);
2927
discoveredSpec.CodeFilePath.EndsWith("StandardSpec.cs", StringComparison.Ordinal);
3028
};
@@ -34,7 +32,6 @@ public class When_discovering_specs : With_DiscoverySetup<BuiltInSpecificationDi
3432
"StandardSpec".Equals(x.ClassName, StringComparison.Ordinal));
3533
discoveredSpec.ShouldNotBeNull();
3634

37-
discoveredSpec.SpecificationDisplayName.ShouldEqual("not implemented");
3835
discoveredSpec.LineNumber.ShouldEqual(0);
3936
discoveredSpec.CodeFilePath.ShouldBeNull();
4037
};
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System;
2+
using System.Linq;
3+
using Machine.Fakes;
4+
using Machine.Specifications;
5+
using Machine.VSTestAdapter.Configuration;
6+
using Machine.VSTestAdapter.Discovery;
7+
using Machine.VSTestAdapter.Execution;
8+
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
9+
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter;
10+
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;
11+
using SampleSpecs;
12+
13+
namespace Machine.VSTestAdapter.Specs.Discovery
14+
{
15+
public class When_DisableFullTestNameInIDE_is_off : WithFakes
16+
{
17+
18+
Because of = () => {
19+
The<MSpecTestAdapter>().DiscoverTests(new[] { typeof(When_something).Assembly.Location },
20+
An<IDiscoveryContext>(),
21+
An<IMessageLogger>(),
22+
The<ITestCaseDiscoverySink>());
23+
};
24+
25+
26+
It should_use_full_type_and_field_name_for_display_name = () => {
27+
The<ITestCaseDiscoverySink>()
28+
.WasToldTo(d => d.SendTestCase(Param<TestCase>.Matches(t => t.DisplayName.Equals("When something it should pass", StringComparison.Ordinal))))
29+
.OnlyOnce();
30+
};
31+
}
32+
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
using System;
2+
using System.Linq;
3+
using Machine.Fakes;
4+
using Machine.Specifications;
5+
using Machine.VSTestAdapter.Helpers;
6+
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
7+
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter;
8+
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;
9+
using SampleSpecs;
10+
11+
namespace Machine.VSTestAdapter.Specs.Discovery
12+
{
13+
public class When_DisableFullTestNameInIDE_is_on : WithFakes
14+
{
15+
static string ConfigurationXml = @"<RunSettings>
16+
<RunConfiguration>
17+
<MaxCpuCount>0</MaxCpuCount>
18+
</RunConfiguration>
19+
<MSpec>
20+
<DisableFullTestNameInIDE>true</DisableFullTestNameInIDE>
21+
</MSpec>
22+
</RunSettings>";
23+
24+
Establish establish = () => {
25+
The<IRunSettings>().WhenToldTo(runSettings => runSettings.SettingsXml).Return(ConfigurationXml);
26+
The<IDiscoveryContext>().WhenToldTo(context => context.RunSettings).Return(The<IRunSettings>());
27+
};
28+
29+
30+
Because of = () => {
31+
The<MSpecTestAdapter>().DiscoverTests(new[] { typeof(StandardSpec).Assembly.Location },
32+
The<IDiscoveryContext>(),
33+
An<IMessageLogger>(),
34+
The<ITestCaseDiscoverySink>());
35+
};
36+
37+
38+
It should_use_test_name_as_display_name = () => {
39+
var specId = new VisualStudioTestIdentifier("SampleSpecs.StandardSpec", "should_pass");
40+
41+
The<ITestCaseDiscoverySink>()
42+
.WasToldTo(d => d.SendTestCase(Param<TestCase>.Matches(t => t.ToVisualStudioTestIdentifier().Equals(specId) &&
43+
t.DisplayName.Equals("should pass", StringComparison.Ordinal))))
44+
.OnlyOnce();
45+
};
46+
}
47+
}

Source/Machine.VSTestAdapter.Specs/Execution/RunListener/TestCaseMapperBehavior.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ public class TestCaseMapperBehavior
1414

1515
It should_provide_correct_details_to_visual_studio = () => {
1616
TestCase.FullyQualifiedName.ShouldEqual("ContainingType::field_name");
17-
TestCase.DisplayName.ShouldEqual("field name");
1817
TestCase.ExecutorUri.ShouldEqual(new Uri("bla://executorUri"));
1918
TestCase.Source.ShouldEqual("assemblyPath");
2019
};

Source/Machine.VSTestAdapter.Specs/Execution/When_using_displayfulltestname_setting.cs renamed to Source/Machine.VSTestAdapter.Specs/Execution/When_DisableFullTestNameInOutput_is_off.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
using System;
2-
using System.Collections.Generic;
32
using System.Linq;
4-
using System.Text;
5-
using System.Threading.Tasks;
63
using Machine.Fakes;
74
using Machine.Specifications;
85
using Machine.VSTestAdapter.Configuration;
@@ -12,15 +9,17 @@
129

1310
namespace Machine.VSTestAdapter.Specs.Execution
1411
{
15-
public class When_using_displayfulltestname_setting : With_SingleSpecExecutionSetup
12+
13+
14+
public class When_DisableFullTestNameInOutput_is_off : With_SingleSpecExecutionSetup
1615
{
1716
static TestCase RecordStartTestCase;
1817
static TestCase RecordEndTestCase;
1918

2019
Establish context = () => {
2120
SpecificationToRun = new VisualStudioTestIdentifier("SampleSpecs.When_something", "should_pass");
2221

23-
The<Settings>().DisplayFullTestNameInOutput = true;
22+
The<Settings>().DisableFullTestNameInOutput = false;
2423

2524
The<IFrameworkHandle>()
2625
.WhenToldTo(handle =>
@@ -37,8 +36,8 @@ public class When_using_displayfulltestname_setting : With_SingleSpecExecutionSe
3736
};
3837

3938
It should_display_both_the_context_name_and_specification_name_on_a_single_line = () => {
40-
RecordStartTestCase.DisplayName.ShouldEqual("SampleSpecs.When_something: should_pass");
41-
RecordEndTestCase.DisplayName.ShouldEqual("SampleSpecs.When_something: should_pass");
39+
RecordStartTestCase.DisplayName.ShouldEqual("SampleSpecs.When_something.should_pass");
40+
RecordEndTestCase.DisplayName.ShouldEqual("SampleSpecs.When_something.should_pass");
4241
};
4342
}
4443
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
using Machine.Fakes;
7+
using Machine.Specifications;
8+
using Machine.VSTestAdapter.Configuration;
9+
using Machine.VSTestAdapter.Helpers;
10+
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
11+
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter;
12+
13+
namespace Machine.VSTestAdapter.Specs.Execution
14+
{
15+
public class When_DisableFullTestNameInOutput_is_on : With_SingleSpecExecutionSetup
16+
{
17+
static TestCase RecordStartTestCase;
18+
static TestCase RecordEndTestCase;
19+
20+
Establish context = () => {
21+
SpecificationToRun = new VisualStudioTestIdentifier("SampleSpecs.When_something", "should_pass");
22+
23+
The<Settings>().DisableFullTestNameInOutput = true;
24+
25+
The<IFrameworkHandle>()
26+
.WhenToldTo(handle =>
27+
handle.RecordStart(Param<TestCase>.Matches(testCase => testCase.ToVisualStudioTestIdentifier().Equals(SpecificationToRun)))
28+
)
29+
.Callback((TestCase testCase) => RecordStartTestCase = testCase);
30+
31+
The<IFrameworkHandle>()
32+
.WhenToldTo(handle =>
33+
handle.RecordEnd(Param<TestCase>.Matches(testCase => testCase.ToVisualStudioTestIdentifier().Equals(SpecificationToRun)),
34+
Param<TestOutcome>.Matches(outcome => outcome == TestOutcome.Passed))
35+
)
36+
.Callback((TestCase testCase) => RecordEndTestCase = testCase);
37+
};
38+
39+
It should_display_both_the_context_name_and_specification_name_on_a_single_line = () => {
40+
RecordStartTestCase.DisplayName.ShouldEqual("should pass");
41+
RecordEndTestCase.DisplayName.ShouldEqual("should pass");
42+
};
43+
}
44+
}

Source/Machine.VSTestAdapter.Specs/Machine.VSTestAdapter.Specs.csproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@
8484
<Reference Include="System.Xml" />
8585
</ItemGroup>
8686
<ItemGroup>
87+
<Compile Include="Discovery\When_DisableFullTestNameInIDE_is_off.cs" />
8788
<Compile Include="Configuration\When_adapter_runs_tests.cs" />
8889
<Compile Include="Configuration\When_parsing_configuration_and_mspec_section_is_missing.cs" />
89-
<Compile Include="Configuration\When_parsing_valid_configuration.cs" />
9090
<Compile Include="Discovery\BuiltIn\When_discovering_specs.cs" />
9191
<Compile Include="Discovery\BuiltIn\When_discovering_behaviors.cs" />
9292
<Compile Include="Discovery\BuiltIn\When_discovering_specs_in_nested_types.cs" />
@@ -101,6 +101,7 @@
101101
<Compile Include="Execution\RunListener\When_specification_ends_with_a_fail.cs" />
102102
<Compile Include="Execution\RunListener\When_specification_ends_with_a_pass.cs" />
103103
<Compile Include="Execution\RunListener\When_specification_starts.cs" />
104+
<Compile Include="Execution\When_DisableFullTestNameInOutput_is_off.cs" />
104105
<Compile Include="Execution\When_running_a_nested_spec_passes.cs" />
105106
<Compile Include="Execution\When_running_a_single_behavior_passes.cs" />
106107
<Compile Include="Execution\When_running_a_spec_that_fails.cs" />
@@ -111,11 +112,12 @@
111112
<Compile Include="Execution\When_running_a_spec_that_throws.cs" />
112113
<Compile Include="Execution\When_running_a_spec_with_custom_act_assert_delegates_passes.cs" />
113114
<Compile Include="Execution\When_running_an_assembly_with_behaviors.cs" />
114-
<Compile Include="Execution\When_using_displayfulltestname_setting.cs" />
115+
<Compile Include="Execution\When_DisableFullTestNameInOutput_is_on.cs" />
115116
<Compile Include="Execution\With_AssemblyExecutionSetup.cs" />
116117
<Compile Include="Execution\With_SingleSpecExecutionSetup.cs" />
117118
<Compile Include="Helper.cs" />
118119
<Compile Include="Properties\AssemblyInfo.cs" />
120+
<Compile Include="Discovery\When_DisableFullTestNameInIDE_is_on.cs" />
119121
<Compile Include="When_there_is_an_unhandled_error_during_test_discovery.cs" />
120122
<Compile Include="When_there_is_an_unhandled_error_during_test_execution.cs" />
121123
</ItemGroup>

0 commit comments

Comments
 (0)