public void CalculateSumAndMaxTest() { 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 <IUDICO.Common.Models.Shared.Statistics.AttemptResult> ARL = new List <IUDICO.Common.Models.Shared.Statistics.AttemptResult>(); ARL.Add(AR); themeRes.AttemptResults = ARL; themeRes.GetThemeResultScore(); CurriculumResult target = new CurriculumResult(); target.ThemeResult.Add(themeRes); Curriculum curr = null; target.CalculateSumAndMax(usr, curr); double?SumExpected = 50.0; double?MaxExpected = 100.0; Assert.AreEqual(SumExpected, target.Sum); Assert.AreEqual(MaxExpected, target.Max); }
public void GetThemeResultScoreTest1() { 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, null); ThemeResult target = new ThemeResult(usr, thm); List <IUDICO.Common.Models.Shared.Statistics.AttemptResult> ARL = new List <IUDICO.Common.Models.Shared.Statistics.AttemptResult>(); ARL.Add(AR); target.AttemptResults = ARL; double?expected = 0.0; double?actual; actual = target.GetThemeResultScore(); Assert.AreEqual(expected, actual); }
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); }