Commit 50f78fc

mo k <mo@mokhan.ca>
2012-04-20 21:10:22
convert BOED to MCF.
1 parent d4a9b16
src/domain/BOED.cs
@@ -4,8 +4,7 @@ namespace domain
   {
     public decimal Convert(decimal amount, IUnitOfMeasure units)
     {
-      // need to do actual conversion here;
-      return amount;
+      return ( units is MCF ) ? amount * 6: amount;
     }
 
     public bool Equals(BOED other)
src/domain/GasPlant.cs
@@ -81,6 +81,7 @@ namespace domain
 
     public IQuantity For(Month month)
     {
+      //return this.increases.Single(x => x.IsFor(month)).;
       return null;
     }
 
@@ -94,6 +95,11 @@ namespace domain
         this.quantity = quantity;
         this.month = month;
       }
+
+      public bool IsFor(Month other)
+      {
+        return month.Equals(other);
+      }
     }
   }
 }
src/test/BOEDSpecs.cs
@@ -0,0 +1,30 @@
+namespace test
+{
+  using Machine.Specifications;
+  using domain;
+
+  public class BOEDSpecs
+  {
+    Establish context = ()=>
+    {
+      sut = new BOED();
+    };
+
+    static IUnitOfMeasure sut;
+
+    public class when_converting_one_BOE_to_MCF
+    {
+      It should_return_6_MCF=()=>
+      {
+        result.ShouldEqual(6m);
+      };
+
+      Because of = ()=>
+      {
+        result = sut.Convert(1, new MCF());
+      };
+
+      static decimal result;
+    }
+  }
+}
src/test/test.csproj
@@ -48,6 +48,7 @@
   <ItemGroup>
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="GreetingSpecs.cs" />
+    <Compile Include="BOEDSpecs.cs" />
     <Compile Include="CalculatorSpecs.cs" />
     <Compile Include="GasPlantSpecs.cs" />
     <Compile Include="Mock.cs" />