forked from cleitonfelipe/BDD_TDD_Training
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dbd01d3
commit 1b78bb0
Showing
9 changed files
with
276 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 16 | ||
VisualStudioVersion = 16.0.29806.167 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Using_NUnit_Specflow", "Using_NUnit_Specflow\Using_NUnit_Specflow.csproj", "{6D168251-6E21-44AF-A6EA-2141686EC9EB}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{6D168251-6E21-44AF-A6EA-2141686EC9EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{6D168251-6E21-44AF-A6EA-2141686EC9EB}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{6D168251-6E21-44AF-A6EA-2141686EC9EB}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{6D168251-6E21-44AF-A6EA-2141686EC9EB}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {14071C4D-94D8-467C-A3E2-328F80A7F704} | ||
EndGlobalSection | ||
EndGlobal |
17 changes: 17 additions & 0 deletions
17
dotnet/bdd/Using_NUnit_Specflow/Using_NUnit_Specflow/Calculator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace Using_NUnit_Specflow | ||
{ | ||
public class Calculator | ||
{ | ||
public int FirstNumber { get; set; } | ||
public int SecondNumber { get; set; } | ||
|
||
public int Add() | ||
{ | ||
return FirstNumber + SecondNumber; | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
dotnet/bdd/Using_NUnit_Specflow/Using_NUnit_Specflow/Features/Calculator.feature
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Feature: Calculator | ||
In order to avoid silly mistakes | ||
As a math idiot | ||
I want to be told the sum of two numbers | ||
|
||
@mytag | ||
Scenario: Add two numbers | ||
Given I have entered 50 into the calculator | ||
And I have also entered 70 into the calculator | ||
When I press add | ||
Then the result should be 120 on the screen |
124 changes: 124 additions & 0 deletions
124
dotnet/bdd/Using_NUnit_Specflow/Using_NUnit_Specflow/Features/Calculator.feature.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
39 changes: 39 additions & 0 deletions
39
dotnet/bdd/Using_NUnit_Specflow/Using_NUnit_Specflow/Steps/CalculatorSteps.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using NUnit.Framework; | ||
using System; | ||
using TechTalk.SpecFlow; | ||
|
||
namespace Using_NUnit_Specflow.Steps | ||
{ | ||
[Binding] | ||
public class CalculatorSteps | ||
{ | ||
|
||
private int result; | ||
private Calculator calculator = new Calculator(); | ||
|
||
[Given(@"I have entered (.*) into the calculator")] | ||
public void GivenIHaveEnteredIntoTheCalculator(int number) | ||
{ | ||
calculator.FirstNumber = number; | ||
} | ||
|
||
[Given(@"I have also entered (.*) into the calculator")] | ||
public void GivenIHaveAlsoEnteredIntoTheCalculator(int number) | ||
{ | ||
calculator.SecondNumber = number; | ||
} | ||
|
||
|
||
[When(@"I press add")] | ||
public void WhenIPressAdd() | ||
{ | ||
result = calculator.Add(); | ||
} | ||
|
||
[Then(@"the result should be (.*) on the screen")] | ||
public void ThenTheResultShouldBeOnTheScreen(int expectedResult) | ||
{ | ||
Assert.AreEqual(expectedResult, result); | ||
} | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
dotnet/bdd/Using_NUnit_Specflow/Using_NUnit_Specflow/Using_NUnit_Specflow.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
|
||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="nunit" Version="3.12.0" /> | ||
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" /> | ||
<PackageReference Include="SpecFlow.NUnit" Version="3.1.86" /> | ||
<PackageReference Include="SpecFlow.Tools.MsBuild.Generation" Version="3.1.86" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
namespace Using_NUnit | ||
{ | ||
public class Calculate | ||
{ | ||
public int Somar(int a, int b) | ||
{ | ||
return a + b; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using NUnit.Framework; | ||
|
||
namespace Using_NUnit | ||
{ | ||
[TestFixture] | ||
public class Calculate_Test | ||
{ | ||
[Test] | ||
public void Somar_2_valor() | ||
{ | ||
var calc = new Calculate(); | ||
|
||
var result = calc.Somar(2, 2); | ||
|
||
Assert.AreEqual(4, result); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netcoreapp3.1</TargetFramework> | ||
|
||
<IsPackable>false</IsPackable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="nunit" Version="3.12.0" /> | ||
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0"/> | ||
</ItemGroup> | ||
|
||
</Project> |