public void DeleteWrongId() { GetReady(); var actRes = controller.Delete(99); var response = actRes.ExecuteAsync(CancellationToken.None).Result; Assert.IsFalse(response.IsSuccessStatusCode); }
public async Task Delete_ReturnsViewResultWithSupplier() { var supplier = new Supplier() { Id = 1 }; // Arrange var mockRepo = new Mock <IInvoicesRepository>(); mockRepo.Setup(repo => repo.GetSupplierAsync(supplier.Id)) .ReturnsAsync(supplier); var controller = new SuppliersController(mockRepo.Object); // Act var result = await controller.Delete(supplier.Id); // Assert var viewResult = Assert.IsType <ViewResult>(result); var model = Assert.IsAssignableFrom <Supplier>(viewResult.ViewData.Model); Assert.Equal(supplier.Id, model.Id); }