Commit cc9d789

mo k <mo@mokhan.ca>
2012-04-17 16:02:50
start to build a Gas Plant.
1 parent 698bee1
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;
+    }
+  }
+}
src/test/Mock.cs
@@ -0,0 +1,10 @@
+namespace test
+{
+  public static class Mock
+  {
+    public static T An<T>()
+    {
+      return MockRepository.GenerateMock<T>();
+    }
+  }
+}
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" />