public void Create_ShouldReturnView() { // Act var result = Controller.Create() as ViewResult; // Assert Assert.IsNotNull(result?.Model, "It should return the View"); }
public void Create_ShouldThrowException(int id) { // Arrange TruckService = new Mock <TruckService>(new FakeUnitOfWorkWithException(), Mapper); Controller = new TrucksController(Logger.Object, TruckService.Object); // Act var result = Controller.Create(new TruckViewModel { Id = id }) as ViewResult; var model = (TruckViewModel)result.Model; // Assert Assert.AreEqual(id, model.Id, "Exception was not thrown"); }