public void Organisation_Create_Invalid_Input() { _mockUserContext.Setup(x => x.HasGroupPermission(It.IsAny <string>(), It.IsAny <string>())).Returns(true); _controller.ModelState.AddModelError("Error", "Error"); var result = _controller.Create(new OrganisationCreateInput()); Assert.IsInstanceOf <JsonResult>(result); var jsonResult = result as JsonResult; Assert.IsNotNull(jsonResult); Assert.AreEqual(jsonResult.Data.ToString().ToLower(), "Failure".ToLower()); }
public void TestCreateOrganisationView() { OrganisationViewModel organisation = new OrganisationViewModel() { Name = "Maarten's Songs" }; RedirectToRouteResult viewResult = (RedirectToRouteResult)_organisationsController.Create(organisation, null); Organisation createdOrganisation = _organisationManager.ReadOrganisation("Maarten's Songs"); Assert.AreEqual("Details/" + createdOrganisation.Id, viewResult.RouteValues["action"]); }