public void notify_consume_of_all_cities_to_power_plant_when_electricity_is_consumed() { var aPowerPlant = Substitute.For <PowerPlant>(); var anArea = new Area(id: Guid.NewGuid()); var anCityConsumer = Substitute.For <CityPowerReceiver>(); anArea.AddPowerReceiver(anCityConsumer); anArea.ReceiveFrom(aPowerPlant, SomePowerPlantPower); var aCityConsumptionReport = new CityConsumptionReport(Guid.NewGuid(), new List <BuildingConsumptionReport>()); var anotherCityConsumptionReport = new CityConsumptionReport(Guid.NewGuid(), new List <BuildingConsumptionReport>()); anArea.GetNotifiedOfElectricConsumeOff(aCityConsumptionReport); anArea.GetNotifiedOfElectricConsumeOff(anotherCityConsumptionReport); anArea.NotifyConsumption(); var expectedConsumptionReport = new AreaConsumptionReport(anArea.Id, new List <CityConsumptionReport> { aCityConsumptionReport, anotherCityConsumptionReport }); aPowerPlant.Received(1).GetNotifiedOfElectricConsumeOff(expectedConsumptionReport); }
public virtual void GetNotifiedOfElectricConsumeOff(AreaConsumptionReport consumptionReport) { consumptionReports.Add(consumptionReport); }