public void Given_NewFuelTank_When_ExessiveAmountOfFuelIsAddedToFuelTank_Then_FuelTankShouldRuptureOverfilled() { Assert.Throws <FuelTankRuptured>(() => { tank.AddFuel(FuelType.Oxygen, 25); }); }
public void Given_NewFuelTank_When_FuelIsAddedToEmptyTank_Then_CurrentVolumeEqualsAmountAdded() { var tank = new FuelTank(FuelType.Oxygen, 5); tank.AddFuel(FuelType.Oxygen, 1); Assert.AreEqual(1, tank.CurrentFuelVolume); }
public void Given_NewFuelTank_When_FuelIsAddedToEmptyTank_Then_CurrentVolumeEqualsAmountAdded_AAA_Example() { // Arrange var tank = new FuelTank(FuelType.Oxygen, 5); // Act tank.AddFuel(FuelType.Oxygen, 1); // Assert Assert.AreEqual(1, tank.CurrentFuelVolume); }
void RefuelCallback(int resourceAmount) { FuelTank tank = PlayerData.Instance.GetCurrentVehicleFuelTank(); ResourceStorage inventory = PlayerData.Instance.GetInventory(); ResourceType type = ResourceType.Crystal; float fuel = tank.Refuel(type, inventory.TakeResource(type, resourceAmount)); tank.AddFuel(fuel); UpdateValues(); }
public void Given_NewFuelTankWithFuel_When_RemovingMoreFuelThanIsCurrentlyInTank_Then_TheTankShouldNotRemoveMoreFuelThanExistsInTheTank() { // Arrange var tank = new FuelTank(FuelType.Oxygen, 5); var amountOfFuel = 2; tank.AddFuel(FuelType.Oxygen, amountOfFuel); // Act // TODO Try to remove more than was added the fuel i.e. remove > 2 fuel and must return no more than 2 fuel // Assert // TODO Assert that tank is empty -> tank.CurrentFuelVolume not negative }
public void Given_NewFuelTankWithFuel_When_RemovingAllFuel_Then_TheTankIsEmpty() { // Arrange var tank = new FuelTank(FuelType.Oxygen, 5); var amountOfFuel = 2; tank.AddFuel(FuelType.Oxygen, amountOfFuel); // Act // TODO Remove the added fuel // Assert // TODO Assert that volume removed is is correct -> tank.CurrentFuelVolume }
public void AddFuel(FuelTank fuelTank, FuelType fuelType, int amountToAdd) { AssertEnsureFuelTypeIsTheSame(fuelTank, fuelType); AssertIfFuelTankWillRupture(fuelTank, amountToAdd); fuelTank.AddFuel(fuelType, amountToAdd); }
private void Refuel() { fuelTank.AddFuel(FUEL_REFUEL_RATE); _shipCreditLevel -= CREDIT_PER_FUEL; }