// -=-=-=-=-=-=-=-=-=-=-=-=- public void UpdateStorageText() { string message = "Energy in storage: " + distModel.GetEnergyStorageCurrentCapacity() + "\n"; message += "Total energy demand: " + distModel.TotalEnergyDemand + "\n"; message += "Total coolant demand: " + distModel.TotalCoolantDemand; mockStorage.text = message; }
public void UpdateModelDecresesEnergyStorageByTotalEnergyDemandTest() { EnergyDistributionModel edm = new EnergyDistributionModel(); EnergyStorage storage = new EnergyStorage(); storage.SetCurrentCapacity(storage.maxCapacity); edm.EnergyStorage = storage; float ec1 = 1.0f, ec2 = 3.0f, ec3 = 0.3f; float sum = ec1 + ec2 + ec3; EnergyConsumer consumer1 = new EnergyConsumer("Beam", ec1, 1.0f), consumer2 = new EnergyConsumer("Missiles", ec2, 0.75f), consumer3 = new EnergyConsumer("Headlights", ec3, 1.5f); edm.AddEnergyConsumer(consumer1); edm.AddEnergyConsumer(consumer2); edm.AddEnergyConsumer(consumer3); float initStorage = edm.GetEnergyStorageCurrentCapacity(); float expected = initStorage - sum; edm.UpdateModel(); Assert.AreEqual(expected, edm.GetEnergyStorageCurrentCapacity()); }