public async Task CheckCreationOfStore_RedirectToActionResult() { var store = new Store(); var bookRepo = new FakeBookRepository(); var pubRepo = new FakePublisherRepository(); var storeRepo = new FakeStoreRepository(); var controller = new StoresController(bookRepo, pubRepo, storeRepo); var result = await controller.Create(store); Assert.IsInstanceOfType(result, typeof(RedirectToActionResult)); }
public async Task CheckCreationOfStoreByWrongPerson_RedirectToModel() { var store = new Store(); var bookRepo = new FakeBookRepository(); var pubRepo = new FakePublisherRepository(); var storeRepo = new FakeStoreRepository(); var controller = new StoresController(bookRepo, pubRepo, storeRepo); controller.ModelState.AddModelError("", "pickAnything"); var result = await controller.Create(store) as ViewResult; Assert.AreEqual(store, result.Model); }
public void Create_CreatesNewInstanceOfStore_True() { ActionResult createPost = _controller.Create("TestTheme"); Assert.IsInstanceOfType(createPost, typeof(ActionResult)); }