main
1namespace test
2{
3 using System.Linq;
4 using System.Collections.Generic;
5 using Machine.Specifications;
6 using Rhino.Mocks;
7 using domain;
8 using utility;
9
10 public class GasPlantSpecs
11 {
12 Establish context = ()=>
13 {
14 sut = new GasPlant();
15 };
16
17 static GasPlant sut;
18
19 public class when_exceeding_a_plants_available_capacity
20 {
21 It should_indicate_the_month_that_the_plant_is_scheduled_to_be_over_capacity =() =>
22 {
23 results.ShouldContain(new Month(2013, 02));
24 };
25
26 Establish context = () =>
27 {
28 firstWell = Mock.An<IWell>();
29 secondWell = Mock.An<IWell>();
30 firstWell.Stub(x => x.GrossProductionFor<Gas>(2013.January())).Return(30m.MCF());
31 secondWell.Stub(x => x.GrossProductionFor<Gas>(2013.January())).Return(31m.MCF());
32 };
33
34 Because of = ()=>
35 {
36 sut.IncreaseCapacityTo(60m.MCF(),2013.January());
37
38 sut.AcceptFlowFrom(firstWell);
39 sut.AcceptFlowFrom(secondWell);
40 results = sut.MonthsOverAvailableCapacity().ToList();
41 };
42
43 static IEnumerable<Month> results;
44 static IWell firstWell;
45 static IWell secondWell;
46 }
47 public class when_retrieving_the_available_capacity_for_a_month
48 {
49 It should_return_the_correct_amount = () =>
50 {
51 result.ShouldEqual(30m.MCF());
52 };
53
54 Because of = () =>
55 {
56 sut.IncreaseCapacityTo(30m.MCF(),Month.Now());
57 result = sut.AvailableCapacityFor(Month.Now());
58 };
59
60 static IQuantity result;
61 }
62 }
63}