public void HabitatBuilderOneTurnProgress_NotEnoughResources_NoProgress() { HabitatBuilder habitatBuilder = new HabitatBuilder("a"); double resourceFactor = 0.5; Resources neededResources = new Resources( resourceFactor * habitatBuilder.CostPerTurn.Hydrogen, resourceFactor * habitatBuilder.CostPerTurn.CommonMetals, resourceFactor * habitatBuilder.CostPerTurn.RareEarthElements ); habitatBuilder.OneTurnProgress(neededResources); Assert.AreEqual(0, habitatBuilder.BuildingProgress); }
public void SystemBuildingsBuildNew_ObjectAddedTwice_CountIsCorrect() { HabitatBuilder habitatBuilder = new HabitatBuilder("a"); HabitatBuilder habitatBuilder2 = new HabitatBuilder("a"); SystemBuildings systemBuildings = new SystemBuildings(); systemBuildings.BuildNew(habitatBuilder); systemBuildings.BuildNew(habitatBuilder); systemBuildings.BuildNew(habitatBuilder2); habitatBuilder2.OneTurnProgress(new Resources(double.MaxValue, double.MaxValue, double.MaxValue)); systemBuildings.BuildNew(habitatBuilder2); Assert.AreEqual(2, systemBuildings.InConstructionCount); }
public void HabitatBuilderOneTurnProgress_EnoughResources_HabitatBuilt() { HabitatBuilder habitatBuilder = new HabitatBuilder("a"); double resourceFactor = habitatBuilder.BuildingDuration * 2; Resources neededResources = new Resources(habitatBuilder.CostPerTurn); neededResources.Multiply(resourceFactor); for (int i = 0; i < resourceFactor; i++) { habitatBuilder.OneTurnProgress(neededResources); } Assert.AreEqual(habitatBuilder.BuildingDuration, habitatBuilder.BuildingProgress); }