Exemplo n.º 1
0
        public void Index_with_no_query_parameters_uses_cookie_value_for_filterBy()
        {
            // When
            var result = administratorController.Index();

            // Then
            result.As <ViewResult>().Model.As <CentreAdministratorsViewModel>().FilterBy.Should()
            .Be("Role|IsCentreAdmin|true");
        }
Exemplo n.º 2
0
        public void Index_calls_expected_methods_and_returns_view()
        {
            // When
            var result = administratorController.Index();

            // Then
            using (new AssertionScope())
            {
                A.CallTo(() => userDataService.GetAdminUsersByCentreId(A <int> ._)).MustHaveHappened();
                A.CallTo(() => courseCategoriesDataService.GetCategoriesForCentreAndCentrallyManagedCourses(A <int> ._))
                .MustHaveHappened();
                A.CallTo(() => userDataService.GetAdminUserById(A <int> ._)).MustHaveHappened();
                A.CallTo(
                    () => searchSortFilterPaginateService.SearchFilterSortAndPaginate(
                        A <IEnumerable <AdminUser> > ._,
                        A <SearchSortFilterAndPaginateOptions> ._
                        )
                    ).MustHaveHappened();
                A.CallTo(
                    () => httpResponse.Cookies.Append(
                        CookieName,
                        A <string> ._,
                        A <CookieOptions> ._
                        )
                    )
                .MustHaveHappened();
                result.Should().BeViewResult().WithDefaultViewName();
            }
        }
Exemplo n.º 3
0
        public void AdminController_Index_Should_Return_ViewResult()
        {
            //Arrange
            var mockedService = new Mock <IAdminService>();
            AdministratorController controller = new AdministratorController(mockedService.Object);

            //Act
            var result = controller.Index();

            //Assert
            Assert.IsInstanceOf <ViewResult>(result);
        }