Skip to content

Commit

Permalink
Add project dotnet
Browse files Browse the repository at this point in the history
  • Loading branch information
cleitonfelipe committed Mar 11, 2020
1 parent dbd01d3 commit 1b78bb0
Show file tree
Hide file tree
Showing 9 changed files with 276 additions and 0 deletions.
25 changes: 25 additions & 0 deletions dotnet/bdd/Using_NUnit_Specflow/Using_NUnit_Specflow.sln
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 dotnet/bdd/Using_NUnit_Specflow/Using_NUnit_Specflow/Calculator.cs
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;
}
}
}
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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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);
}
}
}
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>
10 changes: 10 additions & 0 deletions dotnet/tdd/Using_NUnit/Calculate.cs
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;
}
}
}
18 changes: 18 additions & 0 deletions dotnet/tdd/Using_NUnit/Calculate_Test.cs
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);
}
}
}
15 changes: 15 additions & 0 deletions dotnet/tdd/Using_NUnit/Using_NUnit.csproj
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>

0 comments on commit 1b78bb0

Please sign in to comment.