public void ZeroProgressAtMaxCapacity() { Building testBuilding = BuildingUpgradeTests.GetTestBuilding(); IUnit unit = new MockUnit(.111f); testBuilding.Unit = unit; testBuilding.Tick(new TimeSpan(1, 0, 0)); Assert.AreEqual(0, testBuilding.NextUnitProgress); testBuilding.Dispose(); }
public void TestUnitGeneration(int i_numUnits) { Building testBuilding = BuildingUpgradeTests.GetTestBuilding(); int expectedUnits = Math.Max(0, testBuilding.NumUnits + i_numUnits); expectedUnits = Math.Min(expectedUnits, testBuilding.Capacity); testBuilding.AddUnitsFromProgress(i_numUnits); Assert.AreEqual(testBuilding.NumUnits, expectedUnits); testBuilding.Dispose(); }
public void UnitsGeneratedFromTick(TimeSpan i_timeSpan) { Building testBuilding = BuildingUpgradeTests.GetTestBuilding(); IUnit unit = new MockUnit(1); testBuilding.Unit = unit; int unitsBeforeTick = testBuilding.NumUnits; testBuilding.Tick(i_timeSpan); Assert.AreNotSame(unitsBeforeTick, testBuilding.NumUnits); testBuilding.Dispose(); }
public void BeforeTest() { UnitTestUtils.LoadOfflineData(); UnitTestUtils.LoadMockPlayerData(); UnitData data = GenericDataLoader.GetData <UnitData>(GenericDataLoader.TEST_UNIT); mUnit = new Unit(data, new UnitProgress() { Level = 1, Trainers = 1 }, new ViewModel()); mBuilding = BuildingUpgradeTests.GetTestBuilding(); mBuilding.Unit = mUnit; }