/// <summary>
 /// Initialize purchase controller
 /// </summary>
 /// <param name="courseCtrl">Course API</param>
 /// <param name="myCourseCtrl">MyCourse API</param>
 /// <param name="userProfileRepo">User profile repository</param>
 /// <param name="classRoomRepo">Class room repository</param>
 /// <param name="classCalendarRepo">Class calendar repository</param>
 /// <param name="lessonCatalogRepo">Lesson catalog repository</param>
 /// <param name="userActivityRepo">User activity repository</param>
 /// <param name="paymentRepo">Payment repository</param>
 public PurchaseController(CourseController courseCtrl,
                           MyCourseController myCourseCtrl,
                           IUserProfileRepository userProfileRepo,
                           IClassRoomRepository classRoomRepo,
                           IClassCalendarRepository classCalendarRepo,
                           ILessonCatalogRepository lessonCatalogRepo,
                           IUserActivityRepository userActivityRepo,
                           IPaymentRepository paymentRepo,
                           IOptions <AppConfigOptions> appConfig,
                           IOptions <ErrorMessageOptions> errorMsgs,
                           ILoggerFactory loggerFactory,
                           IPayment payment,
                           IDateTime dateTime)
 {
     _courseCtrl        = courseCtrl;
     _myCourseCtrl      = myCourseCtrl;
     _userprofileRepo   = userProfileRepo;
     _classRoomRepo     = classRoomRepo;
     _classCalendarRepo = classCalendarRepo;
     _lessonCatalogRepo = lessonCatalogRepo;
     _userActivityRepo  = userActivityRepo;
     _paymentRepo       = paymentRepo;
     _dateTime          = dateTime;
     _appConfig         = appConfig.Value;
     _errorMsgs         = errorMsgs.Value;
     _logger            = loggerFactory.CreateLogger <PurchaseController>();
     _payment           = payment;
 }
示例#2
0
        public static bool CanAddNewCourseCatalog(this MyCourseController ctrl, string userprofileId, string courseCatalogId, out IEnumerable <string> allUserCourseCatalogIds)
        {
            allUserCourseCatalogIds = ctrl.GetAllUserCoursCatalogIds(userprofileId);
            var result = allUserCourseCatalogIds.Contains(courseCatalogId);

            return(result);
        }
 /// <summary>
 /// Initialize purchase controller
 /// </summary>
 /// <param name="courseCtrl">Course API</param>
 /// <param name="myCourseCtrl">MyCourse API</param>
 /// <param name="userProfileRepo">User profile repository</param>
 /// <param name="classRoomRepo">Class room repository</param>
 /// <param name="classCalendarRepo">Class calendar repository</param>
 /// <param name="lessonCatalogRepo">Lesson catalog repository</param>
 /// <param name="userActivityRepo">User activity repository</param>
 /// <param name="paymentRepo">Payment repository</param>
 public PurchaseController(CourseController courseCtrl,
     MyCourseController myCourseCtrl,
     IUserProfileRepository userProfileRepo,
     IClassRoomRepository classRoomRepo,
     IClassCalendarRepository classCalendarRepo,
     ILessonCatalogRepository lessonCatalogRepo,
     IUserActivityRepository userActivityRepo,
     IPaymentRepository paymentRepo,
     IOptions<AppConfigOptions> appConfig,
     IOptions<ErrorMessageOptions> errorMsgs,
     ILoggerFactory loggerFactory,
     IPayment payment,
     IDateTime dateTime)
 {
     _courseCtrl = courseCtrl;
     _myCourseCtrl = myCourseCtrl;
     _userprofileRepo = userProfileRepo;
     _classRoomRepo = classRoomRepo;
     _classCalendarRepo = classCalendarRepo;
     _lessonCatalogRepo = lessonCatalogRepo;
     _userActivityRepo = userActivityRepo;
     _paymentRepo = paymentRepo;
     _dateTime = dateTime;
     _appConfig = appConfig.Value;
     _errorMsgs = errorMsgs.Value;
     _logger = loggerFactory.CreateLogger<PurchaseController>();
     _payment = payment;
 }
 /// <summary>
 /// Initialize purchase controller
 /// </summary>
 /// <param name="courseCtrl">Course API</param>
 /// <param name="myCourseCtrl">MyCourse API</param>
 /// <param name="userProfileRepo">User profile repository</param>
 public PurchaseController(CourseController courseCtrl,
                           MyCourseController myCourseCtrl,
                           IUserProfileRepository userProfileRepo,
                           IDateTime dateTime)
 {
     _courseCtrl      = courseCtrl;
     _myCourseCtrl    = myCourseCtrl;
     _userprofileRepo = userProfileRepo;
     _dateTime        = dateTime;
 }
 /// <summary>
 /// Initialize purchase controller
 /// </summary>
 /// <param name="courseCtrl">Course API</param>
 /// <param name="myCourseCtrl">MyCourse API</param>
 /// <param name="userProfileRepo">User profile repository</param>
 public PurchaseController(CourseController courseCtrl, 
     MyCourseController myCourseCtrl,
     IUserProfileRepository userProfileRepo,
     IDateTime dateTime)
 {
     _courseCtrl = courseCtrl;
     _myCourseCtrl = myCourseCtrl;
     _userprofileRepo = userProfileRepo;
     _dateTime = dateTime;
 }
示例#6
0
 public HomeController(CourseController courseCtrl,
     MyCourseController myCourseCtrl,
     IOptions<AppConfigOptions> options,
     IOptions<ErrorMessageOptions> errorMgs,
     ILoggerFactory loggerFactory,
     Engines.IEmailSender mindsageEmailSender)
 {
     _courseCtrl = courseCtrl;
     _myCourseCtrl = myCourseCtrl;
     _appConfig = options.Value;
     _errorMsgs = errorMgs.Value;
     _logger = loggerFactory.CreateLogger<CourseController>();
     _mindsageEmailSender = mindsageEmailSender;
 }
示例#7
0
 public HomeController(CourseController courseCtrl,
                       MyCourseController myCourseCtrl,
                       IOptions <AppConfigOptions> options,
                       IOptions <ErrorMessageOptions> errorMgs,
                       ILoggerFactory loggerFactory,
                       Engines.IEmailSender mindsageEmailSender)
 {
     _courseCtrl          = courseCtrl;
     _myCourseCtrl        = myCourseCtrl;
     _appConfig           = options.Value;
     _errorMsgs           = errorMgs.Value;
     _logger              = loggerFactory.CreateLogger <CourseController>();
     _mindsageEmailSender = mindsageEmailSender;
 }
示例#8
0
 public MyController(MyCourseController myCourseCtrl,
     ProfileController profileCtrl,
     IUserProfileRepository userprofileRepo,
     IClassCalendarRepository classCalendarRepo,
     IOptions<ErrorMessageOptions> errorMsg,
     ILoggerFactory loggerFactory,
     IDateTime dateTime)
 {
     _myCourseCtrl = myCourseCtrl;
     _profileCtrl = profileCtrl;
     _userprofileRepo = userprofileRepo;
     _classCalendarRepo = classCalendarRepo;
     _errorMsgs = errorMsg.Value;
     _logger = loggerFactory.CreateLogger<MyController>();
     _dateTime = dateTime;
 }
示例#9
0
 public MyController(MyCourseController myCourseCtrl,
                     ProfileController profileCtrl,
                     IUserProfileRepository userprofileRepo,
                     IClassCalendarRepository classCalendarRepo,
                     IOptions <ErrorMessageOptions> errorMsg,
                     ILoggerFactory loggerFactory,
                     IDateTime dateTime)
 {
     _myCourseCtrl      = myCourseCtrl;
     _profileCtrl       = profileCtrl;
     _userprofileRepo   = userprofileRepo;
     _classCalendarRepo = classCalendarRepo;
     _errorMsgs         = errorMsg.Value;
     _logger            = loggerFactory.CreateLogger <MyController>();
     _dateTime          = dateTime;
 }
示例#10
0
        public void GivenInitializeMockingData()
        {
            var mock = ScenarioContext.Current.Get<MockRepository>();

            var classRoomRepo = mock.Create<IClassRoomRepository>();
            var likeLessonRepo = mock.Create<ILikeLessonRepository>();
            var userprofileRepo = mock.Create<IUserProfileRepository>();
            var classCalendarRepo = mock.Create<IClassCalendarRepository>();
            var lessonCatalogRepo = mock.Create<ILessonCatalogRepository>();
            var commentRepo = mock.Create<ICommentRepository>();
            var friendRequestRepo = mock.Create<IFriendRequestRepository>();
            var userActivityRepo = mock.Create<IUserActivityRepository>();
            var likeCommentRepo = mock.Create<ILikeCommentRepository>();
            var likeDiscussionRepo = mock.Create<ILikeDiscussionRepository>();
            var studentKeyRepo = mock.Create<IStudentKeyRepository>();
            var notificationRepo = mock.Create<INotificationRepository>();
            var contractRepo = mock.Create<IContractRepository>();
            var courseCatalogRepo = mock.Create<ICourseCatalogRepository>();
            var paymentRepo = mock.Create<IPaymentRepository>();
            var payment = mock.Create<Engines.IPayment>();
            var logger = mock.Create<ILogger>();
            var loggerFactory = mock.Create<ILoggerFactory>();
            var appConfigOption = mock.Create<IOptions<AppConfigOptions>>();
            var errorOption = mock.Create<IOptions<ErrorMessageOptions>>();
            var httpContext = mock.Create<Microsoft.AspNet.Http.HttpContext>();
            var dateTime = mock.Create<IDateTime>();

            appConfigOption.Setup(it => it.Value).Returns(new AppConfigOptions());
            errorOption.Setup(it => it.Value).Returns(new ErrorMessageOptions());

            ScenarioContext.Current.Set(classRoomRepo);
            ScenarioContext.Current.Set(likeLessonRepo);
            ScenarioContext.Current.Set(userprofileRepo);
            ScenarioContext.Current.Set(classCalendarRepo);
            ScenarioContext.Current.Set(lessonCatalogRepo);
            ScenarioContext.Current.Set(commentRepo);
            ScenarioContext.Current.Set(friendRequestRepo);
            ScenarioContext.Current.Set(userActivityRepo);
            ScenarioContext.Current.Set(likeCommentRepo);
            ScenarioContext.Current.Set(likeDiscussionRepo);
            ScenarioContext.Current.Set(studentKeyRepo);
            ScenarioContext.Current.Set(notificationRepo);
            ScenarioContext.Current.Set(contractRepo);
            ScenarioContext.Current.Set(courseCatalogRepo);
            ScenarioContext.Current.Set(paymentRepo);
            ScenarioContext.Current.Set(payment);
            ScenarioContext.Current.Set(logger);
            ScenarioContext.Current.Set(loggerFactory);
            ScenarioContext.Current.Set(appConfigOption);
            ScenarioContext.Current.Set(errorOption);
            ScenarioContext.Current.Set(httpContext);
            ScenarioContext.Current.Set(dateTime);

            loggerFactory.Setup(it => it.CreateLogger(It.IsAny<string>()))
                .Returns(() => logger.Object);

            var notificationCtrl = new NotificationController(userprofileRepo.Object,
                notificationRepo.Object,
                likeLessonRepo.Object,
                likeCommentRepo.Object,
                likeDiscussionRepo.Object,
                commentRepo.Object,
                classCalendarRepo.Object,
                friendRequestRepo.Object,
                dateTime.Object);

            var lessonCtrl = new LessonController(classCalendarRepo.Object,
                userprofileRepo.Object,
                classRoomRepo.Object,
                likeLessonRepo.Object,
                lessonCatalogRepo.Object,
                commentRepo.Object,
                friendRequestRepo.Object,
                userActivityRepo.Object,
                notificationCtrl,
                appConfigOption.Object,
                dateTime.Object);

            var commentCtrl = new CommentController(classCalendarRepo.Object,
                userprofileRepo.Object,
                commentRepo.Object,
                userActivityRepo.Object,
                likeCommentRepo.Object,
                notificationCtrl,
                dateTime.Object);

            var discussionCtrl = new DiscussionController(classCalendarRepo.Object,
                userprofileRepo.Object,
                commentRepo.Object,
                userActivityRepo.Object,
                likeDiscussionRepo.Object,
                notificationCtrl,
                dateTime.Object);

            var myCourseCtrl = new MyCourseController(classCalendarRepo.Object,
                userprofileRepo.Object,
                userActivityRepo.Object,
                classRoomRepo.Object,
                studentKeyRepo.Object,
                lessonCatalogRepo.Object,
                likeLessonRepo.Object,
                likeCommentRepo.Object,
                likeDiscussionRepo.Object,
                contractRepo.Object,
                courseCatalogRepo.Object,
                loggerFactory.Object,
                dateTime.Object);

            var friendCtrl = new FriendController(classCalendarRepo.Object,
                userprofileRepo.Object,
                friendRequestRepo.Object,
                userActivityRepo.Object,
                classRoomRepo.Object,
                dateTime.Object);

            var courseCtrl = new CourseController(courseCatalogRepo.Object, appConfigOption.Object);
            var purchaseCtrl = new PurchaseController(courseCtrl,
                myCourseCtrl,
                userprofileRepo.Object,
                classRoomRepo.Object,
                classCalendarRepo.Object,
                lessonCatalogRepo.Object,
                userActivityRepo.Object,
                paymentRepo.Object,
                appConfigOption.Object,
                errorOption.Object,
                loggerFactory.Object,
                payment.Object,
                dateTime.Object);

            ScenarioContext.Current.Set(notificationCtrl);
            ScenarioContext.Current.Set(lessonCtrl);
            ScenarioContext.Current.Set(commentCtrl);
            ScenarioContext.Current.Set(discussionCtrl);
            ScenarioContext.Current.Set(myCourseCtrl);
            ScenarioContext.Current.Set(friendCtrl);
            ScenarioContext.Current.Set(purchaseCtrl);
        }
示例#11
0
 public HomeController(CourseController courseCtrl, MyCourseController myCourseCtrl)
 {
     _courseCtrl   = courseCtrl;
     _myCourseCtrl = myCourseCtrl;
 }
示例#12
0
        public static bool CanAddNewCourseCatalog(this MyCourseController ctrl, string userprofileId, string courseCatalogId)
        {
            var allUserCourseCatalogIds = Enumerable.Empty <string>();

            return(ctrl.CanAddNewCourseCatalog(userprofileId, courseCatalogId));
        }
示例#13
0
        public static IEnumerable <string> GetAllUserCoursCatalogIds(this MyCourseController ctrl, string userprofileId)
        {
            var qry = ctrl.GetAllCourses(userprofileId).Select(it => it.CourseCatalogId);

            return(qry);
        }
示例#14
0
 public MyController(MyCourseController myCourseCtrl)
 {
     _myCourseCtrl = myCourseCtrl;
 }
示例#15
0
 public MyController(MyCourseController myCourseCtrl)
 {
     _myCourseCtrl = myCourseCtrl;
 }
示例#16
0
        public void GivenInitializeMockingData()
        {
            var mock = ScenarioContext.Current.Get<MockRepository>();

            var classRoomRepo = mock.Create<IClassRoomRepository>();
            var likeLessonRepo = mock.Create<ILikeLessonRepository>();
            var userprofileRepo = mock.Create<IUserProfileRepository>();
            var classCalendarRepo = mock.Create<IClassCalendarRepository>();
            var lessonCatalogRepo = mock.Create<ILessonCatalogRepository>();
            var commentRepo = mock.Create<ICommentRepository>();
            var friendRequestRepo = mock.Create<IFriendRequestRepository>();
            var userActivityRepo = mock.Create<IUserActivityRepository>();
            var likeCommentRepo = mock.Create<ILikeCommentRepository>();
            var likeDiscussionRepo = mock.Create<ILikeDiscussionRepository>();
            var studentKeyRepo = mock.Create<IStudentKeyRepository>();
            var notificationRepo = mock.Create<INotificationRepository>();
            var dateTime = mock.Create<IDateTime>();

            ScenarioContext.Current.Set(classRoomRepo);
            ScenarioContext.Current.Set(likeLessonRepo);
            ScenarioContext.Current.Set(userprofileRepo);
            ScenarioContext.Current.Set(classCalendarRepo);
            ScenarioContext.Current.Set(lessonCatalogRepo);
            ScenarioContext.Current.Set(commentRepo);
            ScenarioContext.Current.Set(friendRequestRepo);
            ScenarioContext.Current.Set(userActivityRepo);
            ScenarioContext.Current.Set(likeCommentRepo);
            ScenarioContext.Current.Set(likeDiscussionRepo);
            ScenarioContext.Current.Set(studentKeyRepo);
            ScenarioContext.Current.Set(notificationRepo);
            ScenarioContext.Current.Set(dateTime);

            var notificationCtrl = new NotificationController(userprofileRepo.Object,
                notificationRepo.Object,
                likeLessonRepo.Object,
                likeCommentRepo.Object,
                likeDiscussionRepo.Object,
                commentRepo.Object,
                classCalendarRepo.Object,
                friendRequestRepo.Object,
                dateTime.Object);

            var myCourseCtrl = new LessonController(classCalendarRepo.Object,
                userprofileRepo.Object,
                classRoomRepo.Object,
                likeLessonRepo.Object,
                lessonCatalogRepo.Object,
                commentRepo.Object,
                friendRequestRepo.Object,
                userActivityRepo.Object,
                notificationCtrl,
                dateTime.Object);

            var commentCtrl = new CommentController(classCalendarRepo.Object,
                userprofileRepo.Object,
                commentRepo.Object,
                userActivityRepo.Object,
                likeCommentRepo.Object,
                notificationCtrl,
                dateTime.Object);

            var discussionCtrl = new DiscussionController(classCalendarRepo.Object,
                userprofileRepo.Object,
                commentRepo.Object,
                userActivityRepo.Object,
                likeDiscussionRepo.Object,
                notificationCtrl,
                dateTime.Object);

            var mycourseCtrl = new MyCourseController(classCalendarRepo.Object,
                userprofileRepo.Object,
                userActivityRepo.Object,
                classRoomRepo.Object,
                studentKeyRepo.Object,
                lessonCatalogRepo.Object,
                likeLessonRepo.Object,
                likeCommentRepo.Object,
                likeDiscussionRepo.Object,
                dateTime.Object);

            var friendCtrl = new FriendController(classCalendarRepo.Object,
                userprofileRepo.Object,
                friendRequestRepo.Object,
                userActivityRepo.Object,
                dateTime.Object);

            ScenarioContext.Current.Set(notificationCtrl);
            ScenarioContext.Current.Set(myCourseCtrl);
            ScenarioContext.Current.Set(commentCtrl);
            ScenarioContext.Current.Set(discussionCtrl);
            ScenarioContext.Current.Set(mycourseCtrl);
            ScenarioContext.Current.Set(friendCtrl);
        }