public async void CalculateUnitOfCommitment_Sum_Of_Power_Should_Be_Equal_To_The_Load(int expectedLoad) { //Arrange var powerplants = PowerplantFixture.GetPowerplantModels(); var fuels = PowerplantFixture.BuildFuels(); var sut = MakeSut(powerplants, fuels); //Act var actualResults = await sut.CalculateUnitOfCommitment(powerplants, expectedLoad, fuels); //Assert Assert.Equal(expectedLoad, actualResults.Sum(x => x.P)); }
public void CalculateCO2EmissionCost_HappyFlow(PowerplantType powerplantType, int powerProduced, decimal expextedCo2Cost) { //Arrange var powerplant = new PowerplantModel { P = powerProduced, Type = powerplantType }; var fuels = PowerplantFixture.BuildFuels(); var sut = new RunningCostService(); //Act sut.CalculateCO2EmissionCost(powerplant, fuels); //Assert Assert.Equal(expextedCo2Cost, powerplant.CO2CostEmission); }
public async void SetMeritOrder_HappyFlow() { //Arrange var powerplants = PowerplantFixture.GetPowerplantModels(); var fuels = PowerplantFixture.BuildFuels(); var sut = new MeritOrderService(); //Act var actualResults = await sut.SetMeritOrder(powerplants, fuels); //Assert foreach (var actualResult in actualResults) { Assert.NotEqual(0, actualResult.MeritOrder); output.WriteLine($"{actualResult.Name} : {actualResult.MeritOrder} position"); Assert.Equal(PowerplantFixture.ExpectedResult() .Where(x => x.Name == actualResult.Name) .Select(x => x.MeritOrder).SingleOrDefault(), actualResult.MeritOrder); } }
public void CalculateRunningCost_HappyFlow(PowerplantType powerplantType, int powerProduced, decimal co2CostEmmission, decimal efficiency, decimal expectedRunningCost) { //Arrange var powerplant = new PowerplantModel { P = powerProduced, Type = powerplantType, Efficiency = efficiency, CO2CostEmission = co2CostEmmission }; var fuels = PowerplantFixture.BuildFuels(); var sut = new RunningCostService(); //Act sut.CalculateRunningCost(powerplant, fuels); //Assert Assert.Equal(expectedRunningCost, powerplant.RunningCost); }
public async void CalculateUnitOfCommitment_HappyFlow() { //Arrange var powerplants = PowerplantFixture.GetPowerplantModels(); var fuels = PowerplantFixture.BuildFuels(); var load = 480; var sut = MakeSut(powerplants, fuels); //Act var actualResults = await sut.CalculateUnitOfCommitment(powerplants, load, fuels); //Assert Assert.Equal(load, actualResults.Sum(x => x.P)); foreach (var actualResult in actualResults) { output.WriteLine($"{actualResult.Name} : {actualResult.P} power"); Assert.Equal(PowerplantFixture.ExpectedResult() .Where(x => x.Name == actualResult.Name) .Select(x => x.P).SingleOrDefault(), actualResult.P); } }