public void AddBuildingToPlanetFalse() { var planet = PlanetFactory.Create(); var building = new BuildingsTest().CreateMetalMine(); // Adds second level Assert.False(planet.AddBuilding(building.BuildingLevels.ElementAt(1))); Assert.Equal(planet.BuiltBuildings.Count, 0); }
public void CheckStartBuildingSuccess() { var planet = PlanetFactory.Create(); var building = new BuildingsTest().CreateMetalMine(); // Start building lvl 1 metal mine Assert.True(planet.StartBuildingBuilding(building.BuildingLevels.ElementAt(0))); Assert.NotNull(planet.CurrentlyBuilding); // Wait for building to be built Thread.Sleep(1001); // Refreshes old build and starts building lvl 2 metal mine Assert.True(planet.StartBuildingBuilding(building.BuildingLevels.ElementAt(1))); Assert.NotNull(planet.CurrentlyBuilding); Assert.Equal(planet.BuiltBuildings.Count, 1); }
public void CheckStartBuildingWhenAlreadyBuilding() { var planet = PlanetFactory.Create(); var building = new BuildingsTest().CreateMetalMine(); // Start building lvl 1 metal mine Assert.True(planet.StartBuildingBuilding(building.BuildingLevels.ElementAt(0))); Assert.NotNull(planet.CurrentlyBuilding); // Wait to short for building to be built Thread.Sleep(200); // Refreshes old build, detects that it has not // finish building and does not start building lvl 2 metal mine Assert.False(planet.StartBuildingBuilding(building.BuildingLevels.ElementAt(1))); Assert.NotNull(planet.CurrentlyBuilding); Assert.Equal(planet.BuiltBuildings.Count, 0); }
public void StopBuildingAfterComplete() { var planet = PlanetFactory.Create(); var building = new BuildingsTest().CreateMetalMine(); // Start building lvl 1 metal mine Assert.True(planet.StartBuildingBuilding(building.BuildingLevels.ElementAt(0))); Assert.NotNull(planet.CurrentlyBuilding); Thread.Sleep(1001); // Stops build after building complete Assert.False(planet.StopBuilding()); }
public void StopBuilding() { var planet = PlanetFactory.Create(); var building = new BuildingsTest().CreateMetalMine(); // Start building lvl 1 metal mine Assert.True(planet.StartBuildingBuilding(building.BuildingLevels.ElementAt(0))); Assert.NotNull(planet.CurrentlyBuilding); // Stops build Assert.True(planet.StopBuilding()); }
public void CheckStartBuildingWhenLowerLvlNotBuilt() { var planet = PlanetFactory.Create(); var building = new BuildingsTest().CreateMetalMine(); // Tires to build lvl 2 metal mine but lvl 1 not built Assert.False(planet.StartBuildingBuilding(building.BuildingLevels.ElementAt(1))); Assert.Null(planet.CurrentlyBuilding); Assert.Equal(planet.BuiltBuildings.Count, 0); }