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 GetThemeResultScoreTest() { 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 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 = 50.0; double? actual; actual = target.GetThemeResultScore(); Assert.AreEqual(expected, actual); }
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); }