public void ShouldCalcTheCorrectTotals( int quantity, decimal powerConsumption, AUSchedule aUSchedule, decimal expTotalPowerConsumption, decimal expTotalOnSolarEnergyConsumption, decimal expTotalOffSolarEnergyConsumption, decimal expTotalEnergyConsumption) { var builder = new ApplianceUsageBuilder(); var applianceUsage = new ApplianceUsage( builder.TestConsumptionCalculator, builder.TestAppliance, quantity, powerConsumption, builder.TestEnabled); applianceUsage.ApplianceUsageSchedule.ClearUsageIntervals(); foreach (var u in aUSchedule.UsageIntervals) { var ti = u.TimeInterval; int startHr = ti.Start.Hours, startMin = ti.Start.Minutes; int endHr = ti.End.Hours, endMin = ti.End.Minutes; applianceUsage.ApplianceUsageSchedule.AddUsageInterval( startHr, startMin, endHr, endMin, u.UsageKind ); } var applianceUsageTotal = new ApplianceUsageTotal(applianceUsage); Assert.Equal(expTotalPowerConsumption, applianceUsageTotal.TotalPowerConsumption); Assert.Equal(expTotalOnSolarEnergyConsumption, applianceUsageTotal.TotalOnSolarEnergyConsumption); Assert.Equal(expTotalOffSolarEnergyConsumption, applianceUsageTotal.TotalOffSolarEnergyConsumption); Assert.Equal(expTotalEnergyConsumption, applianceUsageTotal.TotalEnergyConsumption); }
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); }