public ApplianceUsageBuilder()
 {
     _appliance = new ApplianceBuilder().Build();
     TestConsumptionCalculator = new SiteBuilder().Build().Consumption;
     _applianceUsage           = new ApplianceUsage(TestConsumptionCalculator,
                                                    TestAppliance, TestQuantity, TestPowerConsumption, TestEnabled);
     _applianceUsage.ApplianceUsageSchedule.ClearUsageIntervals();
     _applianceUsage.ApplianceUsageSchedule.AddUsageInterval(8, 0, 10, 0,
                                                             UsageKind.UsingSolar);
     _applianceUsage.ApplianceUsageSchedule.AddUsageInterval(18, 0, 19, 0,
                                                             UsageKind.UsingMains);
 }
示例#2
0
 /// <summary>
 /// Makes an ApplianceUsage line.
 /// </summary>
 /// <remarks>
 /// We're passing in an IConsumptionCalculator so that we can get
 /// the Consumption/Site info like NumSolarHours and tell the
 /// Consumption it should Recalculate(), but without having to
 /// pass in the entire Consumption object, and thus avoiding any
 /// unintended consequences through, say, some weird list-manipulation.
 /// </remarks>
 public ApplianceUsage(IConsumptionCalculator consumptionCalculator,
                       Appliance appliance, int quantity, decimal powerConsumption,
                       bool enabled)
 {
     _consumptionCalculator = consumptionCalculator;
     ApplianceUsageSchedule =
         new ApplianceUsageSchedule(
             consumptionCalculator.ReadOnlySiteSettings);
     this.AddPeakSolarIntervalToSchedule();
     this.SetAppliance(appliance);
     this.SetQuantity(quantity);
     this.SetPowerConsumption(powerConsumption);
     this.SetEnabled(enabled);
     // Recalculate
     this.Recalculate();
 }