public void AccessIsNotAllowedTest() { //Arrange string url = AppSettings.Default.UrlToUserAdminMoneses; //Act AccountController controller = new AccountController(); var result = controller.AccessIsNotAllowed(url) as ViewResult; //Assert Assert.IsNotNull(result); AccessIsNotAllowedViewModel accessIsNotAllowedViewModel = result.ViewData.Model as AccessIsNotAllowedViewModel; Assert.IsNotNull(accessIsNotAllowedViewModel); // Test model value Assert.IsTrue(accessIsNotAllowedViewModel.Url.Equals(url)); }