Permalink
Browse files

SpecsFor

  • Loading branch information...
hlaueriksson committed Jul 30, 2016
1 parent dc8a8b5 commit 96057b2d794d54dba98ed17c09ae26b3b91f37af
@@ -30,6 +30,10 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
+ <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="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>
@@ -50,6 +54,10 @@
<HintPath>..\packages\Machine.Specifications.Should.0.9.0\lib\net45\Machine.Specifications.Should.dll</HintPath>
<Private>True</Private>
</Reference>
+ <Reference Include="Moq, Version=4.2.1510.2205, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
+ <HintPath>..\packages\Moq.4.2.1510.2205\lib\net40\Moq.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
<Reference Include="NSpec, Version=1.0.7.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\nspec.1.0.7\lib\NSpec.dll</HintPath>
<Private>True</Private>
@@ -58,6 +66,22 @@
<HintPath>..\packages\NUnit.2.6.3\lib\nunit.framework.dll</HintPath>
<Private>True</Private>
</Reference>
+ <Reference Include="Should, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <HintPath>..\packages\Should.1.1.20\lib\Should.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
+ <Reference Include="SpecsFor, Version=5.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <HintPath>..\packages\SpecsFor.5.0.0\lib\net40\SpecsFor.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
+ <Reference Include="StructureMap, Version=4.1.3.394, Culture=neutral, processorArchitecture=MSIL">
+ <HintPath>..\packages\structuremap.4.1.3.394\lib\net40\StructureMap.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
+ <Reference Include="StructureMap.Net4, Version=4.1.3.394, Culture=neutral, processorArchitecture=MSIL">
+ <HintPath>..\packages\structuremap.4.1.3.394\lib\net40\StructureMap.Net4.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
@@ -76,6 +100,7 @@
<Compile Include="MSpec\StackSpecs.cs" />
<Compile Include="NSpec\stack_specs.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="SpecsFor\StackSpecs.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
@@ -0,0 +1,5 @@
+# SpecsFor
+
+* Dependencies: NUnit
+* NuGet: https://www.nuget.org/packages/SpecsFor/
+* Source: https://github.com/MattHoneycutt/SpecsFor
@@ -0,0 +1,68 @@
+using System;
+using System.Collections.Generic;
+using NUnit.Framework;
+using Should;
+using SpecsFor;
+
+namespace ConductOfCode.SpecsFor
+{
+ public class StackSpecs
+ {
+ public class given_an_empty_stack : SpecsFor<Stack<int>>
+ {
+ [Test]
+ public void then_it_has_no_elements()
+ {
+ SUT.Count.ShouldEqual(0);
+ }
+
+ [Test]
+ [ExpectedException(typeof(InvalidOperationException))]
+ public void then_it_throws_an_exception_when_calling_pop()
+ {
+ SUT.Pop();
+ }
+
+ [Test]
+ [ExpectedException(typeof(InvalidOperationException))]
+ public void then_it_throws_an_exception_when_calling_peek()
+ {
+ SUT.Peek();
+ }
+ }
+
+ public class given_a_non_empty_stack : SpecsFor<Stack<int>>
+ {
+ protected override void BeforeEachTest()
+ {
+ SUT = new Stack<int>(new[] { 1, 2, 3 });
+ }
+
+ [Test]
+ public void then_it_returns_the_top_element_when_calling_peek()
+ {
+ SUT.Peek().ShouldEqual(3);
+ }
+
+ [Test]
+ public void then_it_does_not_remove_the_top_element_when_calling_peek()
+ {
+ SUT.Peek();
+ SUT.ShouldContain(3);
+ }
+
+ [Test]
+ public void then_it_returns_the_top_element_when_calling_pop()
+ {
+ SUT.Pop().ShouldEqual(3);
+ }
+
+ [Test]
+ public void then_it_removes_the_top_element_when_calling_pop()
+ {
+ SUT.Pop();
+ SUT.ShouldNotContain(3);
+ }
+ }
+ }
+}
@@ -1,10 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
+ <package id="ExpectedObjects" version="1.2.3" 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="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" />
</packages>

0 comments on commit 96057b2

Please sign in to comment.