main
 1namespace domain
 2{
 3  public class Production
 4  {
 5    Month month;
 6    IQuantity produced;
 7    IComposition split;
 8
 9    public Production(Month month, IQuantity produced, IComposition split)
10    {
11      this.month = month;
12      this.produced = produced;
13      this.split = split;
14    }
15
16    public bool IsFor(Month otherMonth)
17    {
18      return month.Equals(otherMonth);
19    }
20
21    public virtual bool OccursDuring(IRange<Month> period)
22    {
23      return period.Contains(this.month);
24    }
25
26    public virtual bool IsGreaterThanAvailableAt(IFacility facility)
27    {
28      return produced.IsGreaterThan(facility.AvailableCapacityFor(this.month));
29    }
30
31    public IQuantity ProductionOf<T>() where T : ICommodity, new()
32    {
33      return split.PercentageOf<T>(produced);
34    }
35  }
36}