public void Delete_ShouldReturn_TotalDeleted() { var result = controller.Delete(1); Assert.Multiple(() => { service.Verify(s => s.Delete(It.IsAny <long>()), Times.Once); Assert.NotNull(result); Assert.IsInstanceOf(typeof(OkObjectResult), result.Result); }); }
public void Delete_returns_BadRequest() { var controller = new ExampleController(Helpers.MockExampleBusinessLogic(), Helpers.MockIAppSettings()); var response = controller.Delete(Helpers.NullModel); response.Should().BeAssignableTo <BadRequestResult>(); }
public void Example_Delete_Get_Null_Id_Should_Return_Error() { // Arrange var controller = new ExampleController(); // Act var result = controller.Delete((string)null) as NotFoundResult; // Assert Assert.AreEqual(404, result.StatusCode); }
public void Example_Delete_InValid_Data_Bogus_Should_Fail() { // Arrange var myController = new ExampleController(); // Act var result = myController.Delete("bogus"); // Assert Assert.IsNotNull(result); }
public void Delete_NoReturn_NoExeption() { // Arrange var controller = new ExampleController(); // Act controller.Delete(1); // Assert // As This example dont have a repository, // we are not able to verify if the object was deleted }
public void Example_Delete_Get_Data_Null_Should_Fail() { // Arrange var myController = new ExampleController(); // Act var result = myController.Delete(null); // Reset // Assert Assert.IsNotNull(result); }
public void Example_Delete_Invalid_Null_Data_Should_Return_Error() { // Arrange var controller = new ExampleController(); string id = "bogus"; // Act var result = controller.Delete(id) as NotFoundResult; // Reset BiliWeb.Backend.DataSourceBackend.Instance.Reset(); // Assert Assert.AreEqual(404, result.StatusCode); }
public void Example_Delete_Get_Default_Should_Return_Data() { // Arrange var controller = new ExampleController(); // Get default student var data = BiliWeb.Backend.DataSourceBackend.Instance.ExampleBackend.Index().FirstOrDefault(); // Act var result = controller.Delete(data.ID, true) as ViewResult; // Reset // Assert Assert.IsNotNull(result.ViewData); }
public void Example_Delete_Get_Default_Should_Pass() { // Arrange var controller = new ExampleController(); string id = BiliWeb.Backend.DataSourceBackend.Instance.ExampleBackend.Index().FirstOrDefault().ID; // Act ViewResult result = controller.Delete(id) as ViewResult; // Reset BiliWeb.Backend.DataSourceBackend.Instance.Reset(); // Assert Assert.IsNotNull(result); }