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

            // Then
            result.As <ViewResult>().Model.As <CourseSetupViewModel>().FilterBy.Should()
            .Be("Status|Active|false");
        }
        public void Index_calls_expected_methods_and_returns_view()
        {
            // When
            var result = controllerWithCookies.Index();

            // Then
            using (new AssertionScope())
            {
                A.CallTo(() => courseService.GetCentreCourseDetails(A <int> ._, A <int?> ._)).MustHaveHappened();
                A.CallTo(
                    () => searchSortFilterPaginateService.SearchFilterSortAndPaginate(
                        A <IEnumerable <CourseStatisticsWithAdminFieldResponseCounts> > ._,
                        A <SearchSortFilterAndPaginateOptions> ._
                        )
                    ).MustHaveHappened();
                A.CallTo(
                    () => httpResponse.Cookies.Append(
                        CookieName,
                        A <string> ._,
                        A <CookieOptions> ._
                        )
                    )
                .MustHaveHappened();
                result.Should().BeViewResult().WithDefaultViewName();
            }
        }
Exemplo n.º 3
0
        public void Index_with_no_filtering_should_default_to_Active_courses()
        {
            // Given
            var controllerWithNoCookies = new CourseSetupController(
                courseService,
                courseCategoryDataService,
                courseTopicsDataService
                )
                                          .WithDefaultContext()
                                          .WithMockUser(true);

            // When
            var result = controllerWithNoCookies.Index();

            // Then
            result.As <ViewResult>().Model.As <CourseSetupViewModel>().FilterBy.Should()
            .Be("Status|Active|true");
        }