diff options
| author | mo k <mo@mokhan.ca> | 2012-04-17 10:02:50 -0600 |
|---|---|---|
| committer | mo k <mo@mokhan.ca> | 2012-04-17 10:02:50 -0600 |
| commit | cc9d789b74f852c97ed237749b949c12bb40ea1b (patch) | |
| tree | 655312a6367fce9a4d6ff347b256a3f3b2baec1d | |
| parent | 698bee18630ed5385b9225e67ef525656e85b928 (diff) | |
start to build a Gas Plant.
| -rw-r--r-- | src/test/GasPlantSpecs.cs | 43 | ||||
| -rw-r--r-- | src/test/Mock.cs | 10 | ||||
| -rwxr-xr-x | src/test/test.csproj | 1 |
3 files changed, 54 insertions, 0 deletions
diff --git a/src/test/GasPlantSpecs.cs b/src/test/GasPlantSpecs.cs new file mode 100644 index 0000000..2992476 --- /dev/null +++ b/src/test/GasPlantSpecs.cs @@ -0,0 +1,43 @@ +namespace test +{ + using System.Linq; + using System.Collections.Generic; + using Rhino.Mocks; + + public class GasPlantSpecs + { + Establish context = ()=> + { + sut = new GasPlant(); + }; + + static GasPlant sut; + + public class when_exceeding_a_plants_available_capacity + { + It should_indicate_the_month_that_the_plant_is_scheduled_to_be_over_capacity =() => + { + results.ShouldContain(new Month(2013, 02)); + }; + + Establish context = () => + { + firstWell = Mock.An<IWell>(); + secondWell = Mock.An<IWell>(); + firstWell.Stub(x => x.GrossProductionFor<Gas>(2013.January())).Return(30m.MCF()); + secondWell.Stub(x => x.GrossProductionFor<Gas>(2013.January())).Return(31m.MCF()); + }; + + Because of = ()=> + { + sut.IncreaseCapacityTo(60m.MCF(),2013.January()); + + sut.AcceptFlowFrom(firstWell); + sut.AcceptFlowFrom(secondWell); + results = sut.MonthsOverAvailableCapacity().ToList(); + }; + + IEnumerable<Month> results; + } + } +} diff --git a/src/test/Mock.cs b/src/test/Mock.cs new file mode 100644 index 0000000..97a8899 --- /dev/null +++ b/src/test/Mock.cs @@ -0,0 +1,10 @@ +namespace test +{ + public static class Mock + { + public static T An<T>() + { + return MockRepository.GenerateMock<T>(); + } + } +} diff --git a/src/test/test.csproj b/src/test/test.csproj index 4bc3ace..b02759e 100755 --- a/src/test/test.csproj +++ b/src/test/test.csproj @@ -47,6 +47,7 @@ <Compile Include="GreetingSpecs.cs" />
<Compile Include="CalculatorSpecs.cs" />
<Compile Include="ProductionScheduleSpecs.cs" />
+ <Compile Include="Mock.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
|
