Skip to content

Commit 513f0fc

Browse files
committed
✨ LightBDD
1 parent 8ffed16 commit 513f0fc

File tree

5 files changed

+140
-0
lines changed

5 files changed

+140
-0
lines changed

BDD/ConductOfCode/ConductOfCode/ConductOfCode.csproj

+19
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,18 @@
3030
<WarningLevel>4</WarningLevel>
3131
</PropertyGroup>
3232
<ItemGroup>
33+
<Reference Include="LightBDD, Version=1.7.1.0, Culture=neutral, processorArchitecture=MSIL">
34+
<HintPath>..\packages\LightBDD.Core.1.7.1.0\lib\net40\LightBDD.dll</HintPath>
35+
<Private>True</Private>
36+
</Reference>
37+
<Reference Include="LightBDD.NUnit, Version=1.7.1.0, Culture=neutral, processorArchitecture=MSIL">
38+
<HintPath>..\packages\LightBDD.NUnit.1.7.1.0\lib\net40\LightBDD.NUnit.dll</HintPath>
39+
<Private>True</Private>
40+
</Reference>
41+
<Reference Include="nunit.framework, Version=2.6.3.13283, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
42+
<HintPath>..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
43+
<Private>True</Private>
44+
</Reference>
3345
<Reference Include="System" />
3446
<Reference Include="System.Core" />
3547
<Reference Include="System.Xml.Linq" />
@@ -40,8 +52,15 @@
4052
<Reference Include="System.Xml" />
4153
</ItemGroup>
4254
<ItemGroup>
55+
<Compile Include="LightBDD\Stack_feature.cs" />
56+
<Compile Include="LightBDD\Stack_feature.Steps.cs">
57+
<DependentUpon>Stack_feature.cs</DependentUpon>
58+
</Compile>
4359
<Compile Include="Properties\AssemblyInfo.cs" />
4460
</ItemGroup>
61+
<ItemGroup>
62+
<None Include="packages.config" />
63+
</ItemGroup>
4564
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
4665
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
4766
Other similar extension points exist, see Microsoft.Common.targets.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# LightBDD
2+
3+
* Dependencies: NUnit | MbUnit | MsTest | xUnit
4+
* NuGet: https://www.nuget.org/packages/LightBDD/
5+
* Source: https://github.com/Suremaker/LightBDD
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using LightBDD;
4+
using NUnit.Framework;
5+
6+
namespace ConductOfCode.LightBDD
7+
{
8+
public partial class Stack_feature : FeatureFixture
9+
{
10+
private Stack<int> stack;
11+
12+
private int result;
13+
14+
// Empty
15+
16+
private void an_empty_stack()
17+
{
18+
stack = new Stack<int>();
19+
}
20+
21+
private void it_has_no_elements()
22+
{
23+
Assert.That(stack, Is.Empty);
24+
}
25+
26+
private void it_throws_an_exception_when_calling_pop()
27+
{
28+
Assert.Throws<InvalidOperationException>(() => stack.Pop());
29+
}
30+
31+
private void it_throws_an_exception_when_calling_peek()
32+
{
33+
Assert.Throws<InvalidOperationException>(() => stack.Peek());
34+
}
35+
36+
// Not empty
37+
38+
private void a_non_empty_stack()
39+
{
40+
stack = new Stack<int>(new[] { 1, 2, 3 });
41+
}
42+
43+
private void calling_peek()
44+
{
45+
result = stack.Peek();
46+
}
47+
48+
private void it_returns_the_top_element()
49+
{
50+
Assert.That(result, Is.EqualTo(3));
51+
}
52+
53+
private void it_does_not_remove_the_top_element()
54+
{
55+
Assert.That(stack.Contains(3), Is.True);
56+
}
57+
58+
private void calling_pop()
59+
{
60+
result = stack.Pop();
61+
}
62+
63+
private void it_removes_the_top_element()
64+
{
65+
Assert.That(stack.Contains(result), Is.False);
66+
}
67+
}
68+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using LightBDD;
2+
using NUnit.Framework;
3+
4+
namespace ConductOfCode.LightBDD
5+
{
6+
[TestFixture]
7+
[FeatureDescription(
8+
@"In order to support last-in-first-out (LIFO) operations
9+
As an developer
10+
I want to use a stack")]
11+
[Label("LIFO")]
12+
public partial class Stack_feature
13+
{
14+
[Test]
15+
[Label("Empty")]
16+
public void Empty_stack()
17+
{
18+
Runner.RunScenario(
19+
20+
given => an_empty_stack(),
21+
then => it_has_no_elements(),
22+
and => it_throws_an_exception_when_calling_pop(),
23+
and => it_throws_an_exception_when_calling_peek());
24+
}
25+
26+
[Test]
27+
[Label("Not empty")]
28+
public void Non_empty_stack()
29+
{
30+
Runner.RunScenario(
31+
32+
given => a_non_empty_stack(),
33+
when => calling_peek(),
34+
then => it_returns_the_top_element(),
35+
but => it_does_not_remove_the_top_element(),
36+
when => calling_pop(),
37+
then => it_returns_the_top_element(),
38+
and => it_removes_the_top_element());
39+
}
40+
}
41+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="LightBDD" version="1.7.1.0" targetFramework="net46" />
4+
<package id="LightBDD.Core" version="1.7.1.0" targetFramework="net46" />
5+
<package id="LightBDD.NUnit" version="1.7.1.0" targetFramework="net46" />
6+
<package id="NUnit" version="2.6.3" targetFramework="net46" />
7+
</packages>

0 commit comments

Comments
 (0)