コード例 #1
0
 /// <summary>
 /// Initialize lesson controller
 /// </summary>
 /// <param name="classCalendarRepo">Class calendar repository</param>
 /// <param name="userprofileRepo">UserProfile repository</param>
 /// <param name="classRoomRepo">Class room repository</param>
 /// <param name="likeLessonRepo">Like lesson repository</param>
 /// <param name="lessonCatalogRepo">Lesson catalog repository</param>
 /// <param name="commentRepo">Comment repository</param>
 /// <param name="friendRequestRepo">Friend request repository</param>
 /// <param name="userActivityRepo">User activity repository</param>
 /// <param name="notificationCtrl">Notificaotion API</param>
 /// <param name="config">App configuration option</param>
 public LessonController(IClassCalendarRepository classCalendarRepo,
     IUserProfileRepository userprofileRepo,
     IClassRoomRepository classRoomRepo,
     ILikeLessonRepository likeLessonRepo,
     ILessonCatalogRepository lessonCatalogRepo,
     ICommentRepository commentRepo,
     IFriendRequestRepository friendRequestRepo,
     IUserActivityRepository userActivityRepo,
     NotificationController notificationCtrl,
     IOptions<AppConfigOptions> options,
     ILessonTestResultRepository lessonTestResultRepo,
     IDateTime dateTime)
 {
     _classCalendarRepo = classCalendarRepo;
     _userprofileRepo = userprofileRepo;
     _classRoomRepo = classRoomRepo;
     _likeLessonRepo = likeLessonRepo;
     _lessonCatalogRepo = lessonCatalogRepo;
     _commentRepo = commentRepo;
     _friendRequestRepo = friendRequestRepo;
     _userActivityRepo = userActivityRepo;
     _notificationCtrl = notificationCtrl;
     _appConfig = options.Value;
     _dateTime = dateTime;
     _lessonTestResultRepo = lessonTestResultRepo;
 }
コード例 #2
0
 /// <summary>
 /// Initialize lesson controller
 /// </summary>
 /// <param name="classCalendarRepo">Class calendar repository</param>
 /// <param name="userprofileRepo">UserProfile repository</param>
 /// <param name="classRoomRepo">Class room repository</param>
 /// <param name="likeLessonRepo">Like lesson repository</param>
 /// <param name="lessonCatalogRepo">Lesson catalog repository</param>
 /// <param name="commentRepo">Comment repository</param>
 /// <param name="friendRequestRepo">Friend request repository</param>
 /// <param name="userActivityRepo">User activity repository</param>
 /// <param name="notificationCtrl">Notificaotion API</param>
 /// <param name="config">App configuration option</param>
 public LessonController(IClassCalendarRepository classCalendarRepo,
                         IUserProfileRepository userprofileRepo,
                         IClassRoomRepository classRoomRepo,
                         ILikeLessonRepository likeLessonRepo,
                         ILessonCatalogRepository lessonCatalogRepo,
                         ICommentRepository commentRepo,
                         IFriendRequestRepository friendRequestRepo,
                         IUserActivityRepository userActivityRepo,
                         NotificationController notificationCtrl,
                         IOptions <AppConfigOptions> options,
                         ILessonTestResultRepository lessonTestResultRepo,
                         IDateTime dateTime)
 {
     _classCalendarRepo    = classCalendarRepo;
     _userprofileRepo      = userprofileRepo;
     _classRoomRepo        = classRoomRepo;
     _likeLessonRepo       = likeLessonRepo;
     _lessonCatalogRepo    = lessonCatalogRepo;
     _commentRepo          = commentRepo;
     _friendRequestRepo    = friendRequestRepo;
     _userActivityRepo     = userActivityRepo;
     _notificationCtrl     = notificationCtrl;
     _appConfig            = options.Value;
     _dateTime             = dateTime;
     _lessonTestResultRepo = lessonTestResultRepo;
 }
コード例 #3
0
 /// <summary>
 /// Initialize comment controller
 /// </summary>
 /// <param name="classCalendarRepo">Class calendar repository</param>
 /// <param name="userprofileRepo">UserProfile repository</param>
 /// <param name="commentRepo">Comment repository</param>
 /// <param name="userActivityRepo">User activity repository</param>
 /// <param name="likeCommentRepo">Like comment repository</param>
 /// <param name="notificationCtrl">Notification API</param>
 public CommentController(IClassCalendarRepository classCalendarRepo,
     IUserProfileRepository userprofileRepo,
     ICommentRepository commentRepo,
     IUserActivityRepository userActivityRepo,
     ILikeCommentRepository likeCommentRepo,
     NotificationController notificationCtrl,
     IDateTime dateTime)
 {
     _notificationCtrl = notificationCtrl;
     _classCalendarRepo = classCalendarRepo;
     _userprofileRepo = userprofileRepo;
     _commentRepo = commentRepo;
     _userActivityRepo = userActivityRepo;
     _likeCommentRepo = likeCommentRepo;
     _dateTime = dateTime;
 }
コード例 #4
0
 /// <summary>
 /// Initialize comment controller
 /// </summary>
 /// <param name="classCalendarRepo">Class calendar repository</param>
 /// <param name="userprofileRepo">UserProfile repository</param>
 /// <param name="commentRepo">Comment repository</param>
 /// <param name="userActivityRepo">User activity repository</param>
 /// <param name="likeCommentRepo">Like comment repository</param>
 /// <param name="notificationCtrl">Notification API</param>
 public CommentController(IClassCalendarRepository classCalendarRepo,
                          IUserProfileRepository userprofileRepo,
                          ICommentRepository commentRepo,
                          IUserActivityRepository userActivityRepo,
                          ILikeCommentRepository likeCommentRepo,
                          NotificationController notificationCtrl,
                          IDateTime dateTime)
 {
     _notificationCtrl  = notificationCtrl;
     _classCalendarRepo = classCalendarRepo;
     _userprofileRepo   = userprofileRepo;
     _commentRepo       = commentRepo;
     _userActivityRepo  = userActivityRepo;
     _likeCommentRepo   = likeCommentRepo;
     _dateTime          = dateTime;
 }
コード例 #5
0
 /// <summary>
 /// Initialize lesson controller
 /// </summary>
 /// <param name="classCalendarRepo">Class calendar repository</param>
 /// <param name="userprofileRepo">UserProfile repository</param>
 /// <param name="classRoomRepo">Class room repository</param>
 /// <param name="likeLessonRepo">Like lesson repository</param>
 /// <param name="lessonCatalogRepo">Lesson catalog repository</param>
 /// <param name="commentRepo">Comment repository</param>
 /// <param name="friendRequestRepo">Friend request repository</param>
 /// <param name="userActivityRepo">User activity repository</param>
 /// <param name="notificationCtrl">Notificaotion API</param>
 public LessonController(IClassCalendarRepository classCalendarRepo,
     IUserProfileRepository userprofileRepo,
     IClassRoomRepository classRoomRepo,
     ILikeLessonRepository likeLessonRepo,
     ILessonCatalogRepository lessonCatalogRepo,
     ICommentRepository commentRepo,
     IFriendRequestRepository friendRequestRepo,
     IUserActivityRepository userActivityRepo,
     NotificationController notificationCtrl,
     IDateTime dateTime)
 {
     _classCalendarRepo = classCalendarRepo;
     _userprofileRepo = userprofileRepo;
     _classRoomRepo = classRoomRepo;
     _likeLessonRepo = likeLessonRepo;
     _lessonCatalogRepo = lessonCatalogRepo;
     _commentRepo = commentRepo;
     _friendRequestRepo = friendRequestRepo;
     _userActivityRepo = userActivityRepo;
     _dateTime = dateTime;
 }
コード例 #6
0
 /// <summary>
 /// Initialize lesson controller
 /// </summary>
 /// <param name="classCalendarRepo">Class calendar repository</param>
 /// <param name="userprofileRepo">UserProfile repository</param>
 /// <param name="classRoomRepo">Class room repository</param>
 /// <param name="likeLessonRepo">Like lesson repository</param>
 /// <param name="lessonCatalogRepo">Lesson catalog repository</param>
 /// <param name="commentRepo">Comment repository</param>
 /// <param name="friendRequestRepo">Friend request repository</param>
 /// <param name="userActivityRepo">User activity repository</param>
 /// <param name="notificationCtrl">Notificaotion API</param>
 public LessonController(IClassCalendarRepository classCalendarRepo,
                         IUserProfileRepository userprofileRepo,
                         IClassRoomRepository classRoomRepo,
                         ILikeLessonRepository likeLessonRepo,
                         ILessonCatalogRepository lessonCatalogRepo,
                         ICommentRepository commentRepo,
                         IFriendRequestRepository friendRequestRepo,
                         IUserActivityRepository userActivityRepo,
                         NotificationController notificationCtrl,
                         IDateTime dateTime)
 {
     _classCalendarRepo = classCalendarRepo;
     _userprofileRepo   = userprofileRepo;
     _classRoomRepo     = classRoomRepo;
     _likeLessonRepo    = likeLessonRepo;
     _lessonCatalogRepo = lessonCatalogRepo;
     _commentRepo       = commentRepo;
     _friendRequestRepo = friendRequestRepo;
     _userActivityRepo  = userActivityRepo;
     _dateTime          = dateTime;
 }
コード例 #7
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);
        }
コード例 #8
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);
        }