Пример #1
0
        public void CalculateSpecializedResultTest()
        {
            IUDICO.Common.Models.User usr = new IUDICO.Common.Models.User() { Username = "******" };
            IUDICO.Common.Models.Theme thm = new IUDICO.Common.Models.Theme() { Name = "Theme One" };
            IUDICO.Common.Models.Shared.Statistics.AttemptResult AR = new IUDICO.Common.Models.Shared.Statistics.AttemptResult(1, usr, thm, IUDICO.Common.Models.Shared.Statistics.CompletionStatus.Completed, IUDICO.Common.Models.Shared.Statistics.AttemptStatus.Completed, IUDICO.Common.Models.Shared.Statistics.SuccessStatus.Passed, DateTime.Now, 0.5f);

            ThemeResult themeRes = new ThemeResult(usr, thm);
            List<AttemptResult> ARL = new List<AttemptResult>();
            ARL.Add(AR);
            themeRes.AttemptResults = ARL;
            themeRes.GetThemeResultScore();

            CurriculumResult currRes = new CurriculumResult();
            currRes.ThemeResult.Add(themeRes);
            Curriculum curr = null;
            currRes.CalculateSumAndMax(usr, curr);

            SpecializedResult target = new SpecializedResult();
            target.CurriculumResult.Add(currRes);
            target.CalculateSpecializedResult(usr);

            double? ExpectedSum = 50.0;
            double? ExpectedMax = 100.0;
            double? ExpectedPercent = 50.0;
            char ExpextedECTS = 'F';

            Assert.AreEqual(ExpectedSum, target.Sum);
            Assert.AreEqual(ExpectedMax, target.Max);
            Assert.AreEqual(ExpectedPercent, target.Percent);
            Assert.AreEqual(ExpextedECTS, target.ECTS);
        }
Пример #2
0
        public AllSpecializedResults GetResults(IEnumerable<User> users, int[] selectedCurriculumIds, ILmsService lmsServiceParam)
        {
            this.lmsService = lmsServiceParam;
            var asr = new AllSpecializedResults
                {
                    Users = users.ToList(),
                    // SelectedDisciplineIds = selectedCurriculumIds,
                    Curriculums =
                        this.lmsService.FindService<ICurriculumService>().GetCurriculums(
                            curr => selectedCurriculumIds.Contains(curr.Id))
                };


            foreach (var usr in asr.Users)
            {
                var specializedResult = new SpecializedResult
                    {
                        Curriculums = asr.Curriculums
                    };

                foreach (var curriculum in specializedResult.Curriculums)
                {
                    var disciplineResult = new DisciplineResult
                        {
                            CurriculumChapterTopics =
                                this.lmsService.FindService<ICurriculumService>().GetCurriculumChapterTopicsByCurriculumId(curriculum.Id)
                        };

                    #region TopicResult

                    foreach (var curriculumChapterTopic in disciplineResult.CurriculumChapterTopics)
                    {
                        var topicResult = new TopicResult(usr, curriculumChapterTopic)
                            {
                                AttemptResults =
                                    this.lmsService.FindService<ITestingService>().GetResults(
                                        usr, curriculumChapterTopic)
                            };
                        topicResult.Res = topicResult.GetTopicResultScore(lmsServiceParam);
                        disciplineResult.TopicResults.Add(topicResult);
                    }

                    #endregion

                    disciplineResult.CalculateSumAndMax(usr, curriculum);
                    specializedResult.DisciplineResults.Add(disciplineResult);
                }
                specializedResult.CalculateSpecializedResult(usr);
                asr.SpecializedResults.Add(specializedResult);
            }
            return asr;
        }
Пример #3
0
        public AllSpecializedResults GetResults(IEnumerable <User> users, int[] selectedCurriculumIds, ILmsService lmsServiceParam)
        {
            this.lmsService = lmsServiceParam;
            var asr = new AllSpecializedResults
            {
                Users = users.ToList(),
                // SelectedDisciplineIds = selectedCurriculumIds,
                Curriculums =
                    this.lmsService.FindService <ICurriculumService>().GetCurriculums(
                        curr => selectedCurriculumIds.Contains(curr.Id))
            };


            foreach (var usr in asr.Users)
            {
                var specializedResult = new SpecializedResult
                {
                    Curriculums = asr.Curriculums
                };

                foreach (var curriculum in specializedResult.Curriculums)
                {
                    var disciplineResult = new DisciplineResult
                    {
                        CurriculumChapterTopics =
                            this.lmsService.FindService <ICurriculumService>().GetCurriculumChapterTopicsByCurriculumId(curriculum.Id)
                    };

                    #region TopicResult

                    foreach (var curriculumChapterTopic in disciplineResult.CurriculumChapterTopics)
                    {
                        var topicResult = new TopicResult(usr, curriculumChapterTopic)
                        {
                            AttemptResults =
                                this.lmsService.FindService <ITestingService>().GetResults(
                                    usr, curriculumChapterTopic)
                        };
                        topicResult.Res = topicResult.GetTopicResultScore(lmsServiceParam);
                        disciplineResult.TopicResults.Add(topicResult);
                    }

                    #endregion

                    disciplineResult.CalculateSumAndMax(usr, curriculum);
                    specializedResult.DisciplineResults.Add(disciplineResult);
                }
                specializedResult.CalculateSpecializedResult(usr);
                asr.SpecializedResults.Add(specializedResult);
            }
            return(asr);
        }
Пример #4
0
        public AllSpecializedResults GetResults(IEnumerable <User> users, int[] selectCurriculumIds, ILmsService ILMS)
        {
            _LmsService = ILMS;
            AllSpecializedResults asr = new AllSpecializedResults();
            SpecializedResult     specializedResult;
            CurriculumResult      curRes;
            ThemeResult           themeResult;


            asr.Users = users.ToList();
            asr.SelectCurriculumIds = selectCurriculumIds;
            asr.Curriculums         = _LmsService.FindService <ICurriculumService>().GetCurriculums(selectCurriculumIds);

            IEnumerable <int> ieIds = selectCurriculumIds;

            foreach (User usr in asr.Users)
            {
                specializedResult             = new SpecializedResult();
                specializedResult.Curriculums = _LmsService.FindService <ICurriculumService>().GetCurriculums(ieIds);
                foreach (Curriculum curr in specializedResult.Curriculums)
                {
                    curRes        = new CurriculumResult();
                    curRes.Themes = _LmsService.FindService <ICurriculumService>().GetThemesByCurriculumId(curr.Id);

                    #region ThemeResult

                    foreach (Theme theme in curRes.Themes)
                    {
                        themeResult = new ThemeResult(usr, theme);
                        themeResult.AttemptResults = _LmsService.FindService <ITestingService>().GetResults(usr, theme);
                        themeResult.Res            = themeResult.GetThemeResultScore();
                        curRes.ThemeResult.Add(themeResult);
                    }

                    #endregion

                    curRes.CalculateSumAndMax(usr, curr);
                    specializedResult.CurriculumResult.Add(curRes);
                }
                specializedResult.CalculateSpecializedResult(usr);
                asr.SpecializedResult.Add(specializedResult);
            }
            return(asr);
        }
Пример #5
0
        public AllSpecializedResults GetResults(IEnumerable <User> users, int[] selectDisciplineIds, ILmsService ILMS)
        {
            _LmsService = ILMS;
            AllSpecializedResults asr = new AllSpecializedResults();
            SpecializedResult     specializedResult;
            DisciplineResult      curRes;
            TopicResult           topicResult;


            asr.Users = users.ToList();
            asr.SelectDisciplineIds = selectDisciplineIds;
            asr.Disciplines         = _LmsService.FindService <ICurriculumService>().GetDisciplines(selectDisciplineIds);

            IEnumerable <int> ieIds = selectDisciplineIds;

            foreach (User usr in asr.Users)
            {
                specializedResult             = new SpecializedResult();
                specializedResult.Disciplines = _LmsService.FindService <ICurriculumService>().GetDisciplines(ieIds);
                foreach (Discipline curr in specializedResult.Disciplines)
                {
                    curRes        = new DisciplineResult();
                    curRes.Topics = _LmsService.FindService <ICurriculumService>().GetTopicsByDisciplineId(curr.Id);

                    #region TopicResult

                    foreach (Topic topic in curRes.Topics)
                    {
                        topicResult = new TopicResult(usr, topic);
                        topicResult.AttemptResults = _LmsService.FindService <ITestingService>().GetResults(usr, topic);
                        topicResult.Res            = topicResult.GetTopicResultScore();
                        curRes.TopicResult.Add(topicResult);
                    }

                    #endregion

                    curRes.CalculateSumAndMax(usr, curr);
                    specializedResult.DisciplineResult.Add(curRes);
                }
                specializedResult.CalculateSpecializedResult(usr);
                asr.SpecializedResult.Add(specializedResult);
            }
            return(asr);
        }
Пример #6
0
        public AllSpecializedResults GetResults(IEnumerable<User> users, int[] selectCurriculumIds, ILmsService ILMS)
        {
            _LmsService = ILMS;
            AllSpecializedResults asr = new AllSpecializedResults();
            SpecializedResult specializedResult;
            CurriculumResult curRes;
            ThemeResult themeResult;

            
            asr.Users = users.ToList();
            asr.SelectCurriculumIds = selectCurriculumIds;
            asr.Curriculums = _LmsService.FindService<ICurriculumService>().GetCurriculums(selectCurriculumIds);

            IEnumerable<int> ieIds = selectCurriculumIds;
            foreach (User usr in asr.Users)
            {
                specializedResult = new SpecializedResult();
                specializedResult.Curriculums = _LmsService.FindService<ICurriculumService>().GetCurriculums(ieIds);
                foreach (Curriculum curr in specializedResult.Curriculums)
                {
                    curRes = new CurriculumResult();
                    curRes.Themes = _LmsService.FindService<ICurriculumService>().GetThemesByCurriculumId(curr.Id);
                    
                    #region ThemeResult

                    foreach (Theme theme in curRes.Themes)
                    {
                        themeResult = new ThemeResult(usr, theme);
                        themeResult.AttemptResults = _LmsService.FindService<ITestingService>().GetResults(usr, theme);
                        themeResult.Res = themeResult.GetThemeResultScore();
                        curRes.ThemeResult.Add(themeResult);
                    }

                    #endregion

                    curRes.CalculateSumAndMax(usr, curr);
                    specializedResult.CurriculumResult.Add(curRes);
                }
                specializedResult.CalculateSpecializedResult(usr);
                asr.SpecializedResult.Add(specializedResult);
            }
            return asr;
        }
Пример #7
0
        public AllSpecializedResults GetResults(IEnumerable<User> users, int[] selectDisciplineIds, ILmsService ILMS)
        {
            _LmsService = ILMS;
            AllSpecializedResults asr = new AllSpecializedResults();
            SpecializedResult specializedResult;
            DisciplineResult curRes;
            TopicResult topicResult;

            
            asr.Users = users.ToList();
            asr.SelectDisciplineIds = selectDisciplineIds;
            asr.Disciplines = _LmsService.FindService<ICurriculumService>().GetDisciplines(selectDisciplineIds);

            IEnumerable<int> ieIds = selectDisciplineIds;
            foreach (User usr in asr.Users)
            {
                specializedResult = new SpecializedResult();
                specializedResult.Disciplines = _LmsService.FindService<ICurriculumService>().GetDisciplines(ieIds);
                foreach (Discipline curr in specializedResult.Disciplines)
                {
                    curRes = new DisciplineResult();
                    curRes.Topics = _LmsService.FindService<ICurriculumService>().GetTopicsByDisciplineId(curr.Id);
                    
                    #region TopicResult

                    foreach (Topic topic in curRes.Topics)
                    {
                        topicResult = new TopicResult(usr, topic);
                        topicResult.AttemptResults = _LmsService.FindService<ITestingService>().GetResults(usr, topic);
                        topicResult.Res = topicResult.GetTopicResultScore();
                        curRes.TopicResult.Add(topicResult);
                    }

                    #endregion

                    curRes.CalculateSumAndMax(usr, curr);
                    specializedResult.DisciplineResult.Add(curRes);
                }
                specializedResult.CalculateSpecializedResult(usr);
                asr.SpecializedResult.Add(specializedResult);
            }
            return asr;
        }
Пример #8
0
 public void EctsTest()
 {
     SpecializedResult sp = new SpecializedResult();
     Assert.AreEqual('A',sp.Ects(99));
     Assert.AreEqual('B', sp.Ects(88));
     Assert.AreEqual('C', sp.Ects(71));
     Assert.AreEqual('D', sp.Ects(69));
     Assert.AreEqual('E', sp.Ects(51));
     Assert.AreEqual('F', sp.Ects(46));
 }
Пример #9
0
        public void CalculateSpecializedResultTest()
        {
            User usr = new User() { Username = "******" };
            Topic thm = new Topic() { Name = "Topic One" };
            AttemptResult AR = new AttemptResult(1, usr, thm, CompletionStatus.Completed, AttemptStatus.Completed, SuccessStatus.Passed, DateTime.Now, 0.5f);

            TopicResult topicRes = new TopicResult(usr, thm);
            List<AttemptResult> ARL = new List<AttemptResult>();
            ARL.Add(AR);
            topicRes.AttemptResults = ARL;
            topicRes.GetTopicResultScore();

            DisciplineResult currRes = new DisciplineResult();
            currRes.TopicResult.Add(topicRes);
            Discipline curr = null;
            currRes.CalculateSumAndMax(usr, curr);

            SpecializedResult target = new SpecializedResult();
            target.DisciplineResult.Add(currRes);
            target.CalculateSpecializedResult(usr);

            double? ExpectedSum = 50.0;
            double? ExpectedMax = 100.0;
            double? ExpectedPercent = 50.0;
            char ExpextedECTS = 'F';

            Assert.AreEqual(ExpectedSum, target.Sum);
            Assert.AreEqual(ExpectedMax, target.Max);
            Assert.AreEqual(ExpectedPercent, target.Percent);
            Assert.AreEqual(ExpextedECTS, target.ECTS);
        }