public void Edit_ShouldGetItem( int id, string chassis) { // Act var result = Controller.Edit(id) as ViewResult; var model = (TruckViewModel)result?.Model; // Assert Assert.AreEqual(chassis, model?.Chassis, "It should return the same Chassis"); }
public void Edit_ShouldThrowException(int id) { // Arrange TruckService = new Mock <TruckService>(new FakeUnitOfWorkWithException(), Mapper); Controller = new TrucksController(Logger.Object, TruckService.Object); // Act var result = Controller.Edit(id, new TruckViewModel { Id = id }) as ViewResult; var model = (TruckViewModel)result.Model; // Assert Assert.AreEqual(id, model.Id, "Exception was not thrown"); }