Skip to content

Commit 0de3531

Browse files
committed
#1 added MSTestContext to ScenarioContext.Current
1 parent e8a5179 commit 0de3531

20 files changed

Lines changed: 561 additions & 13 deletions

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,3 +181,4 @@ UpgradeLog*.htm
181181

182182
# Microsoft Fakes
183183
FakesAssemblies/
184+
/src/.vs/Solution/v15/Server/sqlite3

src/Calculator.Specs/Calculator.Specs.csproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,14 @@
7676
<DesignTime>True</DesignTime>
7777
<DependentUpon>Addition.feature</DependentUpon>
7878
</Compile>
79+
<Compile Include="Features\MSTestContext.feature.cs">
80+
<AutoGen>True</AutoGen>
81+
<DesignTime>True</DesignTime>
82+
<DependentUpon>MSTestContext.feature</DependentUpon>
83+
</Compile>
7984
<Compile Include="Properties\AssemblyInfo.cs" />
8085
<Compile Include="Steps\AdditionSteps.cs" />
86+
<Compile Include="Steps\MSTestContextSteps.cs" />
8187
<Compile Include="UI\Adder.cs">
8288
<DependentUpon>Adder.uitest</DependentUpon>
8389
</Compile>
@@ -93,6 +99,10 @@
9399
<Generator>SpecFlowSingleFileGenerator</Generator>
94100
<LastGenOutput>Addition.feature.cs</LastGenOutput>
95101
</None>
102+
<None Include="Features\MSTestContext.feature">
103+
<Generator>SpecFlowSingleFileGenerator</Generator>
104+
<LastGenOutput>MSTestContext.feature.cs</LastGenOutput>
105+
</None>
96106
<None Include="packages.config" />
97107
<None Include="Specs.testsettings">
98108
<CopyToOutputDirectory>Always</CopyToOutputDirectory>

src/Calculator.Specs/Features/Addition.feature.cs

Lines changed: 41 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Feature: MSTestContext
2+
Having the TestContext available will allow for a lot more automation flexibility
3+
for when integrating the test suit with Microsoft Test Manager
4+
5+
Scenario: MS Test Context available in the scenario context
6+
When this scenario is generated
7+
Then the scenario context contains a key of MSTestContext

src/Calculator.Specs/Features/MSTestContext.feature.cs

Lines changed: 129 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Calculator.Specs/Properties/AssemblyInfo.cs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
1-
using System.Reflection;
1+
/* The MIT License (MIT)
2+
3+
Copyright (c) 2019-2019 Fabricio Correa Duarte
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+
23+
*/
24+
25+
using System.Reflection;
226
using System.Runtime.CompilerServices;
327
using System.Runtime.InteropServices;
428

src/Calculator.Specs/Steps/AdditionSteps.cs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
1-
namespace Calculator.Specs.Steps
1+
/* The MIT License (MIT)
2+
3+
Copyright (c) 2019-2019 Fabricio Correa Duarte
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+
23+
*/
24+
25+
namespace Calculator.Specs.Steps
226
{
327
using Microsoft.VisualStudio.TestTools.UITesting;
428
using Microsoft.VisualStudio.TestTools.UnitTesting;
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/* The MIT License (MIT)
2+
3+
Copyright (c) 2019-2019 Fabricio Correa Duarte
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+
23+
*/
24+
25+
namespace Calculator.Specs.Steps
26+
{
27+
using Microsoft.VisualStudio.TestTools.UnitTesting;
28+
using TechTalk.SpecFlow;
29+
30+
[Binding]
31+
public class MSTestContextSteps
32+
{
33+
[When(@"this scenario is generated")]
34+
public void WhenThisScenarioIsGenerated() { }
35+
36+
[Then(@"the scenario context contains a key of MSTestContext")]
37+
public void ThenTheScenarioContextContainsAKeyOfMSTestContext()
38+
{
39+
Assert.IsTrue(ScenarioContext.Current.ContainsKey("MSTestContext"));
40+
}
41+
42+
}
43+
}

src/Calculator.Specs/UI/Adder.cs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
1-
namespace Calculator.Specs.UI.AdderClasses
1+
/* The MIT License (MIT)
2+
3+
Copyright (c) 2019-2019 Fabricio Correa Duarte
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+
23+
*/
24+
25+
namespace Calculator.Specs.UI.AdderClasses
226
{
327
using System;
428
using System.Collections.Generic;

0 commit comments

Comments
 (0)