Пример #1
0
        public void Builds_personalized_node(int learnerId, KnowledgeNode node,
                                             NodeProgress expectedNodeProgress)
        {
            var result = _instructor.GatherLearningObjectsForLearner(learnerId, node.LearningObjectSummaries);

            result.ShouldBe(expectedNodeProgress.LearningObjects);
        }
Пример #2
0
 public NodeProgress(int id, int learnerId, KnowledgeNode node, NodeStatus status, List <LearningObject> learningObjects) : this()
 {
     Id              = id;
     LearnerId       = learnerId;
     Node            = node;
     Status          = status;
     LearningObjects = learningObjects;
 }
Пример #3
0
        private NodeProgress BuildNodeForLearner(KnowledgeNode node, int learnerId)
        {
            var nodeProgress = _progressRepository.GetNodeProgressForLearner(learnerId, node.Id) ?? new NodeProgress(
                0, learnerId, node, NodeStatus.Unlocked, _instructor.GatherLearningObjectsForLearner(learnerId, node.LearningObjectSummaries)
                );

            //TODO: Create learning session and save.
            _progressRepository.SaveNodeProgress(nodeProgress);

            return(nodeProgress);
        }
Пример #4
0
        private static IProgressService CreateService()
        {
            var kn1       = new KnowledgeNode(1, null, 1);
            var kn2       = new KnowledgeNode(2, null, 1);
            var progress1 = new NodeProgress(1, 0, null, NodeStatus.Unlocked, null);

            Mock <IProgressRepository> progressRepo = new Mock <IProgressRepository>();

            progressRepo.Setup(repo => repo.GetNodeProgressForLearner(1, 1)).Returns(progress1);

            Mock <ILectureRepository> lectureRepo = new Mock <ILectureRepository>();

            lectureRepo.Setup(repo => repo.GetKnowledgeNodeWithSummaries(1)).Returns(kn1);
            lectureRepo.Setup(repo => repo.GetKnowledgeNodeWithSummaries(2)).Returns(kn2);

            return(new ProgressService(new Mock <IInstructor>().Object, lectureRepo.Object, progressRepo.Object));
        }