public Vehicle() { Type = RandomVehicleType(); int tempFuelType = RandomFuel(); FuelType = (EnumFuel)tempFuelType; maxFuel = CapacityChecker(); currentFuel = Program.rngNo.Next(maxFuel / 4, maxFuel); FillAmount = maxFuel - currentFuel; FillTime = Convert.ToInt32(FillAmount / 1.5 * 1000); //fillTime is kept in milliseconds. LeaveTime = DateTime.Now.AddMilliseconds(Program.rngNo.Next(2000, 3001)); }
public void Fuel_ReturnSessionPrice_ValidPositive() { //Arrange EnumFuel name = EnumFuel.Diesel; float pricePerUnit = 0.99F; int sessionCount = 57; float result; float expectedResult = 56.43F; //Act Fuel fuel = new Fuel(name, pricePerUnit); fuel.SessionCount = sessionCount; result = fuel.ReturnSessionPrice(); //Assert Assert.AreEqual(expectedResult, result, "Incorrect session price calculated."); }
public Fuel(EnumFuel name, float price) { Name = name; pricePerUnit = price; }