예제 #1
0
        public void CalculateSpecializedResultTest()
        {
            User usr = new User()
            {
                Username = "******"
            };
            Theme thm = new 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 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);
        }