Permalink
Browse files

Xbehave

  • Loading branch information...
hlaueriksson committed Jul 30, 2016
1 parent 96057b2 commit a11c641a66d284d3ef508358e371475e4056a339
@@ -90,6 +90,30 @@
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
+ <Reference Include="Xbehave.Core, Version=2.1.0.0, Culture=neutral, PublicKeyToken=e4957f48888f9fe8, processorArchitecture=MSIL">
+ <HintPath>..\packages\Xbehave.Core.2.1.0\lib\portable-net45\Xbehave.Core.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
+ <Reference Include="Xbehave.Execution.desktop, Version=2.1.0.0, Culture=neutral, PublicKeyToken=e4957f48888f9fe8, processorArchitecture=MSIL">
+ <HintPath>..\packages\Xbehave.Core.2.1.0\lib\portable-net45\Xbehave.Execution.desktop.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>
+ </Reference>
+ <Reference Include="xunit.assert, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
+ <HintPath>..\packages\xunit.assert.2.1.0\lib\dotnet\xunit.assert.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
+ <Reference Include="xunit.core, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
+ <HintPath>..\packages\xunit.extensibility.core.2.1.0\lib\dotnet\xunit.core.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
+ <Reference Include="xunit.execution.desktop, Version=2.1.0.3179, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
+ <HintPath>..\packages\xunit.extensibility.execution.2.1.0\lib\net45\xunit.execution.desktop.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="DebuggerShim.cs" />
@@ -101,6 +125,7 @@
<Compile Include="NSpec\stack_specs.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SpecsFor\StackSpecs.cs" />
+ <Compile Include="Xbehave\StackFeature.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
@@ -0,0 +1,5 @@
+# xBehave
+
+* Dependencies: xUnit
+* NuGet: https://www.nuget.org/packages/Xbehave/
+* Source: https://github.com/xbehave/xbehave.net
@@ -0,0 +1,51 @@
+using System;
+using System.Collections.Generic;
+using Xbehave;
+using Xunit;
+
+namespace ConductOfCode.Xbehave
+{
+ public class StackFeature
+ {
+ [Scenario]
+ public void Empty(Stack<int> stack)
+ {
+ "Given an empty stack"
+ .x(() => stack = new Stack<int>());
+
+ "Then it has no elements"
+ .x(() => Assert.Empty(stack));
+
+ "And it throws an exception when calling pop"
+ .x(() => Assert.Throws<InvalidOperationException>(() => stack.Pop()));
+
+ "And it throws an exception when calling peek"
+ .x(() => Assert.Throws<InvalidOperationException>(() => stack.Peek()));
+ }
+
+ [Scenario]
+ public void NotEmpty(Stack<int> stack, int result)
+ {
+ "Given a non empty stack"
+ .x(() => stack = new Stack<int>(new[] { 1, 2, 3 }));
+
+ "When calling peek"
+ .x(() => result = stack.Peek());
+
+ "Then it returns the top element"
+ .x(() => Assert.Equal(3, result));
+
+ "But it does not remove the top element"
+ .x(() => Assert.Contains(3, stack));
+
+ "When calling pop"
+ .x(() => result = stack.Pop());
+
+ "The it returns the top element"
+ .x(() => Assert.Equal(3, result));
+
+ "And it removes the top element"
+ .x(() => Assert.DoesNotContain(3, stack));
+ }
+ }
+}
@@ -12,4 +12,12 @@
<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" />
+ <package id="Xbehave" version="2.1.0" targetFramework="net46" />
+ <package id="Xbehave.Core" version="2.1.0" targetFramework="net46" />
+ <package id="xunit" version="2.1.0" targetFramework="net46" />
+ <package id="xunit.abstractions" version="2.0.0" targetFramework="net46" />
+ <package id="xunit.assert" version="2.1.0" targetFramework="net46" />
+ <package id="xunit.core" version="2.1.0" targetFramework="net46" />
+ <package id="xunit.extensibility.core" version="2.1.0" targetFramework="net46" />
+ <package id="xunit.extensibility.execution" version="2.1.0" targetFramework="net46" />
</packages>

0 comments on commit a11c641

Please sign in to comment.