public async void Delete_existing_Store_returns_ok() { //Act var actual = await _controller.Delete(1); // Assert var result = Assert.IsType <StatusCodeResult>(actual); Assert.Equal(200, result.StatusCode); }
public void CanDeleteStore() { var result = _storeController.Delete(1); //Assert.IsInstanceOf<ActionResult>(result); Assert.IsNotNull(result); }
public void DeleteStoreTest(string id) { var controller = new StoreController(this.GetContextWithData()); controller.Delete(id); Assert.That("null", Is.EqualTo(controller.Get(id))); }
public void StoreControllerTest_POST_DELETE() { var store = new Store() { Id = 20, Name = "Shop X", Address = "Address X", District = new District() { Id = 2 } }; var countOld = controller.Get().Count(); controller.Post(store); var countNew = controller.Get().Count(); Assert.AreNotEqual(countOld, countNew); store = controller.Get().ToList().SingleOrDefault(x => { return(x.Name.Equals(store.Name) && x.Address.Equals(store.Address)); }); controller.Delete(store.Id); countNew = controller.Get().Count(); Assert.AreEqual(countOld, countNew); }
public void CanDoPostBackDelete() { //ACT var result = _storeController.Delete(2); //Assert Assert.IsInstanceOf <ActionResult>(result); }
internal static IHttpActionResult Delete() { var _Stores = GetAll() as OkNegotiatedContentResult <IEnumerable <Store> >; var StoreIDs = _Stores.Content.Select(t => t.ID).ToList(); var response = baseController.Delete(StoreIDs); return(response); }
public void Delete([Values(12)] int id) { _controller.Request.Method = HttpMethod.Delete; var actual = _controller.Delete(id, new UserProfile() { Id = 9999, StoreIds = new[] { id } }) as OkNegotiatedContentResult <string>; Assert.IsNotNull(actual); }
public void DeleteRemovesGameAndRedirectsToIndex() { //Arrange var mock = new Mock <IStore>(); var controller = new StoreController(mock.Object); //Act var result = controller.Delete(1); //Assert var model = Assert.IsType <RedirectToActionResult>(result); Assert.Equal("Index", model.ActionName); mock.Verify(m => m.DeleteGame(1)); }
public async void Delete_Errors() { StoreControllerMockFacade mock = new StoreControllerMockFacade(); var mockResult = new Mock <ActionResponse>(); mockResult.SetupGet(x => x.Success).Returns(false); mock.ServiceMock.Setup(x => x.Delete(It.IsAny <int>())).Returns(Task.FromResult <ActionResponse>(mockResult.Object)); StoreController controller = new StoreController(mock.ApiSettingsMoc.Object, mock.LoggerMock.Object, mock.TransactionCoordinatorMock.Object, mock.ServiceMock.Object, mock.ModelMapperMock.Object); controller.ControllerContext = new ControllerContext(); controller.ControllerContext.HttpContext = new DefaultHttpContext(); IActionResult response = await controller.Delete(default(int)); response.Should().BeOfType <ObjectResult>(); (response as ObjectResult).StatusCode.Should().Be((int)HttpStatusCode.UnprocessableEntity); mock.ServiceMock.Verify(x => x.Delete(It.IsAny <int>())); }