Skip to content

Commit

Permalink
✨ Concordion
Browse files Browse the repository at this point in the history
  • Loading branch information
hlaueriksson committed Jul 30, 2016
1 parent a11c641 commit 33631d5
Show file tree
Hide file tree
Showing 6 changed files with 256 additions and 4 deletions.
5 changes: 5 additions & 0 deletions BDD/ConductOfCode/ConductOfCode/Concordion/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Concordion.NET

* Dependencies: NUnit
* NuGet: https://www.nuget.org/packages/Concordion.NET/
* Source: https://github.com/concordion/concordion.net
29 changes: 29 additions & 0 deletions BDD/ConductOfCode/ConductOfCode/Concordion/Stack.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html xmlns:concordion="http://www.concordion.org/2007/concordion">
<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
</head>
<body>
<h1>Stack</h1>
<pre>
In order to support last-in-first-out (LIFO) operations
As an developer
I want to use a stack
</pre>

<h2>Empty</h2>
<p concordion:execute="GivenAnEmptyStack()">Given an empty stack</p>
<p concordion:assert-true="IsEmpty()">Then it has no elements</p>
<p concordion:assert-true="ShouldThrowWhenPop()">And it throws an exception when calling pop</p>
<p concordion:assert-true="ShouldThrowWhenPeek()">And it throws an exception when calling peek</p>

<h2>Not empty</h2>
<p concordion:execute="GivenANonEmptyStack()">Given a non empty stack</p>
<p concordion:execute="#result = Peek()">When calling peek</p>
<p concordion:assert-true="#result == TopElement">Then it returns the top element</p>
<p concordion:assert-true="Contains(#result)">But it does not remove the top element</p>
<p concordion:execute="#result = Pop()">When calling pop</p>
<p concordion:assert-true="#result == TopElement">Then it returns the top element</p>
<p concordion:assert-true="DoesNotContain(#result)">And it removes the top element</p>
</body>
</html>
80 changes: 80 additions & 0 deletions BDD/ConductOfCode/ConductOfCode/Concordion/StackTest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
using Concordion.NET.Integration;
using Concordion.Runners.NUnit;
using NUnit.Framework;

namespace ConductOfCode.Concordion
{
[TestFixture]
[ConcordionTest]
public class StackTest : ExecutableSpecification
{
private Stack<int> stack;

public int TopElement => 3;

// Empty

public void GivenAnEmptyStack()
{
stack = new Stack<int>();
}

public bool IsEmpty()
{
return stack.Count == 0;
}

public bool ShouldThrowWhenPop()
{
return ShouldThrowWhen(() => stack.Pop());
}

public bool ShouldThrowWhenPeek()
{
return ShouldThrowWhen(() => stack.Peek());
}

private bool ShouldThrowWhen(Action action)
{
try
{
action();
}
catch
{
return true;
}

return false;
}

// Not empty

public void GivenANonEmptyStack()
{
stack = new Stack<int>(new[] { 1, 2, TopElement });
}

public int Pop()
{
return stack.Pop();
}

public int Peek()
{
return stack.Peek();
}

public bool Contains(int value)
{
return stack.Contains(value);
}

public bool DoesNotContain(int value)
{
return !stack.Contains(value);
}
}
}
140 changes: 138 additions & 2 deletions BDD/ConductOfCode/ConductOfCode/ConductOfCode.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,134 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Concordion, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Concordion.NET.1.5.0\lib\Concordion.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Concordion.NET, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Concordion.NET.1.5.0\lib\Concordion.NET.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Concordion.Runners, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Concordion.NET.1.5.0\lib\Concordion.Runners.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="ExpectedObjects, Version=1.2.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ExpectedObjects.1.2.3\lib\net40\ExpectedObjects.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="IKVM.AWT.WinForms, Version=8.1.5717.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
<HintPath>..\packages\IKVM.8.1.5717.0\lib\IKVM.AWT.WinForms.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="IKVM.OpenJDK.Beans, Version=8.1.5717.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
<HintPath>..\packages\IKVM.8.1.5717.0\lib\IKVM.OpenJDK.Beans.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="IKVM.OpenJDK.Charsets, Version=8.1.5717.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
<HintPath>..\packages\IKVM.8.1.5717.0\lib\IKVM.OpenJDK.Charsets.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="IKVM.OpenJDK.Cldrdata, Version=8.1.5717.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
<HintPath>..\packages\IKVM.8.1.5717.0\lib\IKVM.OpenJDK.Cldrdata.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="IKVM.OpenJDK.Corba, Version=8.1.5717.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
<HintPath>..\packages\IKVM.8.1.5717.0\lib\IKVM.OpenJDK.Corba.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="IKVM.OpenJDK.Core, Version=8.1.5717.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
<HintPath>..\packages\IKVM.8.1.5717.0\lib\IKVM.OpenJDK.Core.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="IKVM.OpenJDK.Jdbc, Version=8.1.5717.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
<HintPath>..\packages\IKVM.8.1.5717.0\lib\IKVM.OpenJDK.Jdbc.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="IKVM.OpenJDK.Localedata, Version=8.1.5717.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
<HintPath>..\packages\IKVM.8.1.5717.0\lib\IKVM.OpenJDK.Localedata.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="IKVM.OpenJDK.Management, Version=8.1.5717.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
<HintPath>..\packages\IKVM.8.1.5717.0\lib\IKVM.OpenJDK.Management.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="IKVM.OpenJDK.Media, Version=8.1.5717.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
<HintPath>..\packages\IKVM.8.1.5717.0\lib\IKVM.OpenJDK.Media.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="IKVM.OpenJDK.Misc, Version=8.1.5717.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
<HintPath>..\packages\IKVM.8.1.5717.0\lib\IKVM.OpenJDK.Misc.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="IKVM.OpenJDK.Naming, Version=8.1.5717.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
<HintPath>..\packages\IKVM.8.1.5717.0\lib\IKVM.OpenJDK.Naming.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="IKVM.OpenJDK.Nashorn, Version=8.1.5717.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
<HintPath>..\packages\IKVM.8.1.5717.0\lib\IKVM.OpenJDK.Nashorn.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="IKVM.OpenJDK.Remoting, Version=8.1.5717.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
<HintPath>..\packages\IKVM.8.1.5717.0\lib\IKVM.OpenJDK.Remoting.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="IKVM.OpenJDK.Security, Version=8.1.5717.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
<HintPath>..\packages\IKVM.8.1.5717.0\lib\IKVM.OpenJDK.Security.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="IKVM.OpenJDK.SwingAWT, Version=8.1.5717.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
<HintPath>..\packages\IKVM.8.1.5717.0\lib\IKVM.OpenJDK.SwingAWT.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="IKVM.OpenJDK.Text, Version=8.1.5717.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
<HintPath>..\packages\IKVM.8.1.5717.0\lib\IKVM.OpenJDK.Text.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="IKVM.OpenJDK.Tools, Version=8.1.5717.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
<HintPath>..\packages\IKVM.8.1.5717.0\lib\IKVM.OpenJDK.Tools.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="IKVM.OpenJDK.Util, Version=8.1.5717.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
<HintPath>..\packages\IKVM.8.1.5717.0\lib\IKVM.OpenJDK.Util.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="IKVM.OpenJDK.XML.API, Version=8.1.5717.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
<HintPath>..\packages\IKVM.8.1.5717.0\lib\IKVM.OpenJDK.XML.API.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="IKVM.OpenJDK.XML.Bind, Version=8.1.5717.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
<HintPath>..\packages\IKVM.8.1.5717.0\lib\IKVM.OpenJDK.XML.Bind.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="IKVM.OpenJDK.XML.Crypto, Version=8.1.5717.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
<HintPath>..\packages\IKVM.8.1.5717.0\lib\IKVM.OpenJDK.XML.Crypto.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="IKVM.OpenJDK.XML.Parse, Version=8.1.5717.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
<HintPath>..\packages\IKVM.8.1.5717.0\lib\IKVM.OpenJDK.XML.Parse.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="IKVM.OpenJDK.XML.Transform, Version=8.1.5717.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
<HintPath>..\packages\IKVM.8.1.5717.0\lib\IKVM.OpenJDK.XML.Transform.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="IKVM.OpenJDK.XML.WebServices, Version=8.1.5717.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
<HintPath>..\packages\IKVM.8.1.5717.0\lib\IKVM.OpenJDK.XML.WebServices.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="IKVM.OpenJDK.XML.XPath, Version=8.1.5717.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
<HintPath>..\packages\IKVM.8.1.5717.0\lib\IKVM.OpenJDK.XML.XPath.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="IKVM.Runtime, Version=8.1.5717.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
<HintPath>..\packages\IKVM.8.1.5717.0\lib\IKVM.Runtime.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="IKVM.Runtime.JNI, Version=8.1.5717.0, Culture=neutral, PublicKeyToken=13235d27fcbfff58, processorArchitecture=MSIL">
<HintPath>..\packages\IKVM.8.1.5717.0\lib\IKVM.Runtime.JNI.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="LightBDD, Version=1.7.1.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\LightBDD.Core.1.7.1.0\lib\net40\LightBDD.dll</HintPath>
<Private>True</Private>
Expand Down Expand Up @@ -62,8 +186,12 @@
<HintPath>..\packages\nspec.1.0.7\lib\NSpec.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="nunit.framework, Version=2.6.3.13283, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
<Reference Include="nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<HintPath>..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="OGNL, Version=1.0.3982.16799, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Concordion.NET.1.5.0\lib\OGNL.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Should, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
Expand Down Expand Up @@ -98,6 +226,10 @@
<HintPath>..\packages\Xbehave.Core.2.1.0\lib\portable-net45\Xbehave.Execution.desktop.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xom, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Concordion.NET.1.5.0\lib\xom.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
<HintPath>..\packages\xunit.abstractions.2.0.0\lib\net35\xunit.abstractions.dll</HintPath>
<Private>True</Private>
Expand All @@ -116,6 +248,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Concordion\StackTest.cs" />
<Compile Include="DebuggerShim.cs" />
<Compile Include="LightBDD\Stack_feature.cs" />
<Compile Include="LightBDD\Stack_feature.Steps.cs">
Expand All @@ -131,6 +264,9 @@
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Concordion\Stack.html" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
2 changes: 1 addition & 1 deletion BDD/ConductOfCode/ConductOfCode/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="nunit.framework" publicKeyToken="96d09a1eb7f44a77" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.6.3.13283" newVersion="2.6.3.13283" />
<bindingRedirect oldVersion="0.0.0.0-2.6.4.14350" newVersion="2.6.4.14350" />
</dependentAssembly>
</assemblyBinding>
</runtime>
Expand Down
4 changes: 3 additions & 1 deletion BDD/ConductOfCode/ConductOfCode/packages.config
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Concordion.NET" version="1.5.0" targetFramework="net46" />
<package id="ExpectedObjects" version="1.2.3" targetFramework="net46" />
<package id="IKVM" version="8.1.5717.0" targetFramework="net46" />
<package id="LightBDD" version="1.7.1.0" targetFramework="net46" />
<package id="LightBDD.Core" version="1.7.1.0" targetFramework="net46" />
<package id="LightBDD.NUnit" version="1.7.1.0" targetFramework="net46" />
<package id="Machine.Specifications" version="0.9.3" targetFramework="net46" />
<package id="Machine.Specifications.Should" version="0.9.0" targetFramework="net46" />
<package id="Moq" version="4.2.1510.2205" targetFramework="net46" />
<package id="nspec" version="1.0.7" targetFramework="net46" />
<package id="NUnit" version="2.6.3" targetFramework="net46" />
<package id="NUnit" version="2.6.4" targetFramework="net46" />
<package id="Should" version="1.1.20" targetFramework="net46" />
<package id="SpecsFor" version="5.0.0" targetFramework="net46" />
<package id="structuremap" version="4.1.3.394" targetFramework="net46" />
Expand Down

0 comments on commit 33631d5

Please sign in to comment.