public void TotalVehicleCostNullTransportTest() { // arrange List <Vehicle> transport = null; // act var ex = Assert.ThrowsException <ArgumentNullException>(() => AutoparkInfoService.TotalVehicleCost(transport)); // assert Assert.AreEqual(ex.ParamName, "Transport can`t be null"); }
public void RunController() { _consoleOutput.ShowMessage($"Autopark cost - {AutoparkInfoService.autoparkCost}"); _consoleOutput.ShowMessage($"Autopark square - {AutoparkInfoService.autoparkSquare}"); _consoleOutput.ShowMessage($"Total vehicle cost - {AutoparkInfoService.TotalVehicleCost(_transport)}"); _consoleOutput.ShowMessage(string.Empty.PadLeft(150, '-')); _autoparkInfoService.BuyVehicle(_transport, 4, VehicleType.Truck); _consoleOutput.ShowMessage($"Buy 4 vehicle. Vehicle count - {_transport.Count}"); _autoparkInfoService.SellVehicle(_transport, 2); _consoleOutput.ShowMessage($"Sell 2 vehicle. Vehicle count - {_transport.Count}"); _consoleOutput.ShowMessage($"Sort by Id: \n{string.Join('\n', AutoparkInfoService.SortByCriteria(_transport, SortingCriteriaType.Id))}"); _consoleOutput.ShowMessage(string.Empty.PadLeft(150, '-')); }
public void TotalVehicleCostDefaultTransportTest() { // arrange var transport = new List <Vehicle>() { new () { Id = 1, Cost = 50000 }, new () { Id = 1, Cost = 23000, } }; // act var actualResult = AutoparkInfoService.TotalVehicleCost(transport); // assert Assert.AreEqual(73000, actualResult); }