public static void GivenACallToSearchSortFilterPaginateServiceReturnsResult <T>( ISearchSortFilterPaginateService searchSortFilterPaginateService, int maxItemsBeforeJavascriptSearchDisabled = 250 ) where T : BaseSearchableItem { A.CallTo( () => searchSortFilterPaginateService.SearchFilterSortAndPaginate( A <IEnumerable <T> > ._, A <SearchSortFilterAndPaginateOptions> ._ ) ).ReturnsLazily( x => { var items = x.Arguments.Get <IEnumerable <T> >("items")?.ToList() ?? new List <T>(); var options = x.Arguments.Get <SearchSortFilterAndPaginateOptions>("searchSortFilterAndPaginateOptions"); return(new SearchSortFilterPaginationResult <T>( new PaginationResult <T>( items, options !.PaginationOptions?.PageNumber ?? 1, 1, options.PaginationOptions?.ItemsPerPage ?? int.MaxValue, items.Count, items.Count <= maxItemsBeforeJavascriptSearchDisabled ), options.SearchOptions?.SearchString, options.SortOptions?.SortBy, options.SortOptions?.SortDirection, options.FilterOptions?.FilterString )); } ); }
public void Setup() { centreRegistrationPromptsService = A.Fake <ICentreRegistrationPromptsService>(); delegateDownloadFileService = A.Fake <IDelegateDownloadFileService>(); promptsHelper = new PromptsService(centreRegistrationPromptsService); userDataService = A.Fake <IUserDataService>(); jobGroupsDataService = A.Fake <IJobGroupsDataService>(); searchSortFilterPaginateService = A.Fake <ISearchSortFilterPaginateService>(); httpRequest = A.Fake <HttpRequest>(); httpResponse = A.Fake <HttpResponse>(); const string cookieValue = "ActiveStatus|Active|false"; allDelegatesController = new AllDelegatesController( delegateDownloadFileService, userDataService, promptsHelper, jobGroupsDataService, searchSortFilterPaginateService ) .WithMockHttpContext(httpRequest, CookieName, cookieValue, httpResponse) .WithMockUser(true) .WithMockServices() .WithMockTempData(); }
public SupervisorController( ISupervisorService supervisorService, ICommonService commonService, IFrameworkNotificationService frameworkNotificationService, ISelfAssessmentService selfAssessmentService, IFrameworkService frameworkService, IConfigDataService configDataService, ICentreRegistrationPromptsService centreRegistrationPromptsService, IUserDataService userDataService, ILogger <SupervisorController> logger, IConfiguration config, ISearchSortFilterPaginateService searchSortFilterPaginateService, IMultiPageFormService multiPageFormService, IRegistrationService registrationService ) { this.supervisorService = supervisorService; this.commonService = commonService; this.frameworkNotificationService = frameworkNotificationService; this.selfAssessmentService = selfAssessmentService; this.frameworkService = frameworkService; this.configDataService = configDataService; this.centreRegistrationPromptsService = centreRegistrationPromptsService; this.userDataService = userDataService; this.logger = logger; this.config = config; this.searchSortFilterPaginateService = searchSortFilterPaginateService; this.multiPageFormService = multiPageFormService; this.registrationService = registrationService; }
public void Setup() { courseService = A.Fake <ICourseService>(); courseDelegatesDownloadFileService = A.Fake <ICourseDelegatesDownloadFileService>(); searchSortFilterPaginateService = A.Fake <ISearchSortFilterPaginateService>(); A.CallTo(() => courseService.GetCentreCourseDetailsWithAllCentreCourses(A <int> ._, A <int?> ._)) .Returns(details); A.CallTo(() => courseService.GetApplicationOptionsAlphabeticalListForCentre(A <int> ._, A <int?> ._, A <int?> ._)) .Returns(applicationOptions); httpRequest = A.Fake <HttpRequest>(); httpResponse = A.Fake <HttpResponse>(); const string cookieValue = "Status|Active|false"; controllerWithCookies = new DelegateCoursesController( courseService, courseDelegatesDownloadFileService, searchSortFilterPaginateService ) .WithMockHttpContext(httpRequest, CookieName, cookieValue, httpResponse) .WithMockUser(true, 101) .WithMockTempData(); }
public LearningPortalController( ICentresDataService centresDataService, ICourseDataService courseDataService, ISelfAssessmentService selfAssessmentService, ISupervisorService supervisorService, IFrameworkService frameworkService, INotificationService notificationService, IFrameworkNotificationService frameworkNotificationService, ILogger <LearningPortalController> logger, IConfiguration config, IActionPlanService actionPlanService, ICandidateAssessmentDownloadFileService candidateAssessmentDownloadFileService, ISearchSortFilterPaginateService searchSortFilterPaginateService, IMultiPageFormService multiPageFormService ) { this.centresDataService = centresDataService; this.courseDataService = courseDataService; this.selfAssessmentService = selfAssessmentService; this.supervisorService = supervisorService; this.frameworkService = frameworkService; this.notificationService = notificationService; this.frameworkNotificationService = frameworkNotificationService; this.logger = logger; this.config = config; this.actionPlanService = actionPlanService; this.candidateAssessmentDownloadFileService = candidateAssessmentDownloadFileService; this.searchSortFilterPaginateService = searchSortFilterPaginateService; this.multiPageFormService = multiPageFormService; }
public void Setup() { centreRegistrationPromptsService = A.Fake <ICentreRegistrationPromptsService>(); promptsHelper = new PromptsService(centreRegistrationPromptsService); userService = A.Fake <IUserService>(); jobGroupsDataService = A.Fake <IJobGroupsDataService>(); passwordResetService = A.Fake <IPasswordResetService>(); searchSortFilterPaginateService = A.Fake <ISearchSortFilterPaginateService>(); config = A.Fake <IConfiguration>(); httpRequest = A.Fake <HttpRequest>(); httpResponse = A.Fake <HttpResponse>(); const string cookieValue = "JobGroupId|JobGroupId|1"; emailDelegatesController = new EmailDelegatesController( promptsHelper, jobGroupsDataService, passwordResetService, userService, searchSortFilterPaginateService, config ) .WithMockHttpContext(httpRequest, CookieName, cookieValue, httpResponse) .WithMockUser(true) .WithMockServices() .WithMockTempData(); }
public DelegateGroupsController( ICentreRegistrationPromptsService centreRegistrationPromptsService, IGroupsService groupsService, ISearchSortFilterPaginateService searchSortFilterPaginateService ) { this.centreRegistrationPromptsService = centreRegistrationPromptsService; this.groupsService = groupsService; this.searchSortFilterPaginateService = searchSortFilterPaginateService; }
public DelegateCoursesController( ICourseService courseService, ICourseDelegatesDownloadFileService courseDelegatesDownloadFileService, ISearchSortFilterPaginateService searchSortFilterPaginateService ) { this.courseService = courseService; this.courseDelegatesDownloadFileService = courseDelegatesDownloadFileService; this.searchSortFilterPaginateService = searchSortFilterPaginateService; }
public FaqsController( IConfiguration configuration, IFaqsService faqsService, ISearchSortFilterPaginateService searchSortFilterPaginateService ) { this.configuration = configuration; this.faqsService = faqsService; this.searchSortFilterPaginateService = searchSortFilterPaginateService; }
public SystemNotificationsController( ISystemNotificationsDataService systemNotificationsDataService, IClockService clockService, ISearchSortFilterPaginateService searchSortFilterPaginateService ) { this.systemNotificationsDataService = systemNotificationsDataService; this.clockService = clockService; this.searchSortFilterPaginateService = searchSortFilterPaginateService; }
public GroupCoursesController( IUserService userService, ICourseService courseService, IGroupsService groupsService, ISearchSortFilterPaginateService searchSortFilterPaginateService ) { this.userService = userService; this.courseService = courseService; this.groupsService = groupsService; this.searchSortFilterPaginateService = searchSortFilterPaginateService; }
public void Setup() { configuration = A.Fake <IConfiguration>(); faqsService = A.Fake <IFaqsService>(); searchSortFilterPaginateService = A.Fake <ISearchSortFilterPaginateService>(); A.CallTo(() => faqsService.GetPublishedFaqsForTargetGroup(0)) .Returns(faqs); A.CallTo(() => faqsService.GetPublishedFaqByIdForTargetGroup(2, 0)) .Returns(faqs.ElementAt(1)); A.CallTo(() => faqsService.GetPublishedFaqByIdForTargetGroup(5, 0)) .Returns(null); }
public LearningContentController( IBrandsService brandsService, ITutorialService tutorialService, ICourseService courseService, ISearchSortFilterPaginateService searchSortFilterPaginateService ) { this.brandsService = brandsService; this.tutorialService = tutorialService; this.courseService = courseService; this.searchSortFilterPaginateService = searchSortFilterPaginateService; }
public void SetUp() { actionPlanService = A.Fake <IActionPlanService>(); centresDataService = A.Fake <ICentresDataService>(); courseDataService = A.Fake <ICourseDataService>(); selfAssessmentService = A.Fake <ISelfAssessmentService>(); supervisorService = A.Fake <ISupervisorService>(); frameworkService = A.Fake <IFrameworkService>(); notificationService = A.Fake <INotificationService>(); frameworkNotificationService = A.Fake <IFrameworkNotificationService>(); candidateAssessmentDownloadFileService = A.Fake <ICandidateAssessmentDownloadFileService>(); var logger = A.Fake <ILogger <LearningPortalController> >(); config = A.Fake <IConfiguration>(); filteredApiHelperService = A.Fake <IFilteredApiHelperService>(); searchSortFilterPaginateService = A.Fake <ISearchSortFilterPaginateService>(); A.CallTo(() => config["CurrentSystemBaseUrl"]).Returns(BaseUrl); var user = new ClaimsPrincipal( new ClaimsIdentity( new[] { new Claim("learnCandidateID", CandidateId.ToString()), new Claim("UserCentreID", CentreId.ToString()), }, "mock" ) ); controller = new LearningPortalController( centresDataService, courseDataService, selfAssessmentService, supervisorService, frameworkService, notificationService, frameworkNotificationService, logger, config, actionPlanService, candidateAssessmentDownloadFileService, searchSortFilterPaginateService, multiPageFormService ); controller.ControllerContext = new ControllerContext { HttpContext = new DefaultHttpContext { User = user } }; controller = controller.WithMockTempData(); }
public GroupDelegatesController( IJobGroupsService jobGroupsService, IUserService userService, PromptsService promptsService, IGroupsService groupsService, ISearchSortFilterPaginateService searchSortFilterPaginateService ) { this.promptsService = promptsService; this.jobGroupsService = jobGroupsService; this.userService = userService; this.groupsService = groupsService; this.searchSortFilterPaginateService = searchSortFilterPaginateService; }
public AllDelegatesController( IDelegateDownloadFileService delegateDownloadFileService, IUserDataService userDataService, PromptsService promptsService, IJobGroupsDataService jobGroupsDataService, ISearchSortFilterPaginateService searchSortFilterPaginateService ) { this.delegateDownloadFileService = delegateDownloadFileService; this.userDataService = userDataService; this.promptsService = promptsService; this.jobGroupsDataService = jobGroupsDataService; this.searchSortFilterPaginateService = searchSortFilterPaginateService; }
public FindYourCentreController( ICentresService centresService, IRegionDataService regionDataService, ISearchSortFilterPaginateService searchSortFilterPaginateService, IConfiguration configuration, IFeatureManager featureManager ) { this.centresService = centresService; this.regionDataService = regionDataService; this.searchSortFilterPaginateService = searchSortFilterPaginateService; this.configuration = configuration; this.featureManager = featureManager; }
public void Setup() { courseService = A.Fake <ICourseService>(); tutorialService = A.Fake <ITutorialService>(); sectionService = A.Fake <ISectionService>(); searchSortFilterPaginateService = A.Fake <ISearchSortFilterPaginateService>(); config = A.Fake <IConfiguration>(); multiPageFormService = A.Fake <IMultiPageFormService>(); A.CallTo( () => courseService.GetCentreSpecificCourseStatisticsWithAdminFieldResponseCounts( A <int> ._, A <int> ._, false ) ).Returns(courses); A.CallTo(() => courseService.GetCentreCourseDetails(A <int> ._, A <int?> ._)).Returns(details); A.CallTo( () => courseService.GetApplicationOptionsAlphabeticalListForCentre(A <int> ._, A <int?> ._, A <int?> ._) ).Returns(applicationOptions); httpRequest = A.Fake <HttpRequest>(); httpResponse = A.Fake <HttpResponse>(); controller = new CourseSetupController( courseService, tutorialService, sectionService, searchSortFilterPaginateService, config, multiPageFormService ) .WithDefaultContext() .WithMockUser(true, 101) .WithMockTempData(); const string cookieValue = "Status|Active|false"; controllerWithCookies = new CourseSetupController( courseService, tutorialService, sectionService, searchSortFilterPaginateService, config, multiPageFormService ) .WithMockHttpContext(httpRequest, CookieName, cookieValue, httpResponse) .WithMockUser(true, 101) .WithMockTempData(); }
public AdministratorController( IUserDataService userDataService, ICourseCategoriesDataService courseCategoriesDataService, ICentreContractAdminUsageService centreContractAdminUsageService, IUserService userService, ISearchSortFilterPaginateService searchSortFilterPaginateService ) { this.userDataService = userDataService; this.courseCategoriesDataService = courseCategoriesDataService; this.centreContractAdminUsageService = centreContractAdminUsageService; this.userService = userService; this.searchSortFilterPaginateService = searchSortFilterPaginateService; }
public DelegateProgressController( ICourseService courseService, ICourseAdminFieldsService courseAdminFieldsService, IUserService userService, IProgressService progressService, IConfiguration configuration, ISearchSortFilterPaginateService searchSortFilterPaginateService ) { this.courseService = courseService; this.courseAdminFieldsService = courseAdminFieldsService; this.userService = userService; this.progressService = progressService; this.configuration = configuration; this.searchSortFilterPaginateService = searchSortFilterPaginateService; }
public EmailDelegatesController( PromptsService promptsService, IJobGroupsDataService jobGroupsDataService, IPasswordResetService passwordResetService, IUserService userService, ISearchSortFilterPaginateService searchSortFilterPaginateService, IConfiguration config ) { this.promptsService = promptsService; this.jobGroupsDataService = jobGroupsDataService; this.passwordResetService = passwordResetService; this.userService = userService; this.searchSortFilterPaginateService = searchSortFilterPaginateService; this.config = config; }
public void Setup() { regionDataService = A.Fake <IRegionDataService>(); centresService = A.Fake <ICentresService>(); searchSortFilterPaginateService = A.Fake <ISearchSortFilterPaginateService>(); configuration = A.Fake <IConfiguration>(); featureManager = A.Fake <IFeatureManager>(); controller = new FindYourCentreController( centresService, regionDataService, searchSortFilterPaginateService, configuration, featureManager ); }
public CourseSetupController( ICourseService courseService, ITutorialService tutorialService, ISectionService sectionService, ISearchSortFilterPaginateService searchSortFilterPaginateService, IConfiguration config, IMultiPageFormService multiPageFormService ) { this.courseService = courseService; this.tutorialService = tutorialService; this.sectionService = sectionService; this.searchSortFilterPaginateService = searchSortFilterPaginateService; this.config = config; this.multiPageFormService = multiPageFormService; }
public RecommendedLearningController( IFilteredApiHelperService filteredApiHelperService, ISelfAssessmentService selfAssessmentService, IConfiguration configuration, IRecommendedLearningService recommendedLearningService, IActionPlanService actionPlanService, ISearchSortFilterPaginateService searchSortFilterPaginateService ) { this.filteredApiHelperService = filteredApiHelperService; this.selfAssessmentService = selfAssessmentService; this.configuration = configuration; this.recommendedLearningService = recommendedLearningService; this.actionPlanService = actionPlanService; this.searchSortFilterPaginateService = searchSortFilterPaginateService; }
public void SetUp() { courseAdminFieldsService = A.Fake <ICourseAdminFieldsService>(); courseDelegatesService = A.Fake <ICourseDelegatesService>(); courseDelegatesDownloadFileService = A.Fake <ICourseDelegatesDownloadFileService>(); searchSortFilterPaginateService = A.Fake <ISearchSortFilterPaginateService>(); controller = new CourseDelegatesController( courseAdminFieldsService, courseDelegatesService, courseDelegatesDownloadFileService, searchSortFilterPaginateService ) .WithDefaultContext() .WithMockUser(true, UserCentreId); }
public void SetUp() { frameworkService = A.Fake <IFrameworkService>(); frameworkNotificationService = A.Fake <IFrameworkNotificationService>(); commonService = A.Fake <ICommonService>(); var logger = A.Fake <ILogger <FrameworksController> >(); config = A.Fake <IConfiguration>(); importCompetenciesFromFileService = A.Fake <IImportCompetenciesFromFileService>(); competencyLearningResourcesDataService = A.Fake <ICompetencyLearningResourcesDataService>(); learningHubApiClient = A.Fake <ILearningHubApiClient>(); searchSortFilterPaginateService = A.Fake <ISearchSortFilterPaginateService>(); multiPageFormService = A.Fake <IMultiPageFormService>(); A.CallTo(() => config["CurrentSystemBaseUrl"]).Returns(BaseUrl); var user = new ClaimsPrincipal( new ClaimsIdentity( new[] { new Claim("UserAdminId", AdminId.ToString()), new Claim("UserCentreID", CentreId.ToString()), new Claim("IsFrameworkDeveloper", "True"), }, "mock" ) ); controller = new FrameworksController( frameworkService, commonService, frameworkNotificationService, logger, importCompetenciesFromFileService, competencyLearningResourcesDataService, learningHubApiClient, searchSortFilterPaginateService, multiPageFormService ) { ControllerContext = new ControllerContext { HttpContext = new DefaultHttpContext { User = user } }, }; }
public void Setup() { httpRequest = A.Fake <HttpRequest>(); httpResponse = A.Fake <HttpResponse>(); systemNotificationsDataService = A.Fake <ISystemNotificationsDataService>(); searchSortFilterPaginateService = A.Fake <ISearchSortFilterPaginateService>(); controller = new SystemNotificationsController( systemNotificationsDataService, clockService, searchSortFilterPaginateService ) .WithMockHttpContext(httpRequest, response: httpResponse) .WithMockUser(true) .WithMockServices() .WithMockTempData(); }
public void Setup() { courseService = A.Fake <ICourseService>(); courseAdminFieldsService = A.Fake <ICourseAdminFieldsService>(); userService = A.Fake <IUserService>(); progressService = A.Fake <IProgressService>(); searchSortFilterPaginateService = A.Fake <ISearchSortFilterPaginateService>(); var config = A.Fake <IConfiguration>(); delegateProgressController = new DelegateProgressController( courseService, courseAdminFieldsService, userService, progressService, config, searchSortFilterPaginateService ) .WithDefaultContext() .WithMockUser(true); }
public void Setup() { filteredApiHelperService = A.Fake <IFilteredApiHelperService>(); selfAssessmentService = A.Fake <ISelfAssessmentService>(); configuration = A.Fake <IConfiguration>(); recommendedLearningService = A.Fake <IRecommendedLearningService>(); actionPlanService = A.Fake <IActionPlanService>(); searchSortFilterPaginateService = A.Fake <ISearchSortFilterPaginateService>(); controller = new RecommendedLearningController( filteredApiHelperService, selfAssessmentService, configuration, recommendedLearningService, actionPlanService, searchSortFilterPaginateService ) .WithDefaultContext() .WithMockUser(true, delegateId: DelegateId); }
public void Setup() { centreRegistrationPromptsService = A.Fake <ICentreRegistrationPromptsService>(); groupsService = A.Fake <IGroupsService>(); searchSortFilterPaginateService = A.Fake <ISearchSortFilterPaginateService>(); httpRequest = A.Fake <HttpRequest>(); httpResponse = A.Fake <HttpResponse>(); const string cookieValue = "LinkedToField|LinkedToField|0"; delegateGroupsController = new DelegateGroupsController( centreRegistrationPromptsService, groupsService, searchSortFilterPaginateService ) .WithMockHttpContext(httpRequest, CookieName, cookieValue, httpResponse) .WithMockUser(true) .WithMockServices() .WithMockTempData(); }