예제 #1
0
 public LearningMenuController(
     ILogger <LearningMenuController> logger,
     IConfiguration config,
     IConfigService configService,
     ICourseContentService courseContentService,
     ISectionContentDataService sectionContentDataService,
     ITutorialContentDataService tutorialContentDataService,
     IDiagnosticAssessmentDataService diagnosticAssessmentDataService,
     IDiagnosticAssessmentService diagnosticAssessmentService,
     IPostLearningAssessmentService postLearningAssessmentService,
     ISessionService sessionService,
     ICourseCompletionService courseCompletionService
     )
 {
     this.logger                          = logger;
     this.config                          = config;
     this.configService                   = configService;
     this.courseContentService            = courseContentService;
     this.tutorialContentDataService      = tutorialContentDataService;
     this.sessionService                  = sessionService;
     this.sectionContentDataService       = sectionContentDataService;
     this.diagnosticAssessmentDataService = diagnosticAssessmentDataService;
     this.diagnosticAssessmentService     = diagnosticAssessmentService;
     this.postLearningAssessmentService   = postLearningAssessmentService;
     this.courseCompletionService         = courseCompletionService;
 }
예제 #2
0
 public static string GetMedia(ICourseContentService courseContentService, string value)
 {
     if (value != null && value.StartsWith(ServiceConstant.MediaPrefix))
     {
         var mediaResourceId = int.Parse(value.Substring(ServiceConstant.MediaPrefix.Length));
         return courseContentService.GetMedia(mediaResourceId).Url;
     }
     return value;
 }
예제 #3
0
 public static string GetTrans(ICourseContentService courseContentService, string value)
 {
     if (value.StartsWith(ServiceConstant.BlurbPrefix))
     {
         var blurbId = int.Parse(value.Substring(ServiceConstant.BlurbPrefix.Length));
         return courseContentService.GetText(blurbId).Text;
     }
     return value;
 }
예제 #4
0
        public void SetUp()
        {
            var logger = A.Fake <ILogger <LearningMenuController> >();

            config                          = A.Fake <IConfiguration>();
            configService                   = A.Fake <IConfigService>();
            courseContentService            = A.Fake <ICourseContentService>();
            tutorialContentDataService      = A.Fake <ITutorialContentDataService>();
            sessionService                  = A.Fake <ISessionService>();
            sectionContentDataService       = A.Fake <ISectionContentDataService>();
            diagnosticAssessmentDataService = A.Fake <IDiagnosticAssessmentDataService>();
            diagnosticAssessmentService     = A.Fake <IDiagnosticAssessmentService>();
            postLearningAssessmentService   = A.Fake <IPostLearningAssessmentService>();
            courseCompletionService         = A.Fake <ICourseCompletionService>();

            var user = new ClaimsPrincipal(new ClaimsIdentity(new[]
            {
                new Claim("learnCandidateID", CandidateId.ToString()),
                new Claim("UserCentreID", CentreId.ToString())
            }, "mock"));

            httpContextSession = new MockHttpContextSession();

            controller = new LearningMenuController(
                logger,
                config,
                configService,
                courseContentService,
                sectionContentDataService,
                tutorialContentDataService,
                diagnosticAssessmentDataService,
                diagnosticAssessmentService,
                postLearningAssessmentService,
                sessionService,
                courseCompletionService
                )
            {
                ControllerContext = new ControllerContext
                {
                    HttpContext = new DefaultHttpContext
                    {
                        User    = user,
                        Session = httpContextSession
                    }
                }
            };
        }
        public void SetUp()
        {
            var logger = A.Fake <ILogger <LearningMenuController> >();

            config                        = A.Fake <IConfiguration>();
            configDataService             = A.Fake <IConfigDataService>();
            courseContentService          = A.Fake <ICourseContentService>();
            tutorialContentDataService    = A.Fake <ITutorialContentDataService>();
            sessionService                = A.Fake <ISessionService>();
            sectionContentDataService     = A.Fake <ISectionContentDataService>();
            diagnosticAssessmentService   = A.Fake <IDiagnosticAssessmentService>();
            postLearningAssessmentService = A.Fake <IPostLearningAssessmentService>();
            courseCompletionService       = A.Fake <ICourseCompletionService>();
            clockService                  = A.Fake <IClockService>();

            controller = new LearningMenuController(
                logger,
                config,
                configDataService,
                courseContentService,
                sectionContentDataService,
                tutorialContentDataService,
                diagnosticAssessmentService,
                postLearningAssessmentService,
                sessionService,
                courseCompletionService,
                clockService
                ).WithDefaultContext()
                         .WithMockHttpContextSession()
                         .WithMockUser(true, CentreId, null, CandidateId, null)
                         .WithMockTempData()
                         .WithMockServices();

            authenticationService =
                (IAuthenticationService)controller.HttpContext.RequestServices.GetService(
                    typeof(IAuthenticationService)
                    );
            httpContextSession = controller.HttpContext.Session;
        }
예제 #6
0
 public SearchService(ICourseContentService courseContentService)
 {
     this._courseContentService = courseContentService;
 }
예제 #7
0
 public CourseController(ICourseContentService courseContentService, ISearchService searchService)
 {
     this._courseContentService = courseContentService;
     this._searchService = searchService;
 }