public void TestPlusOneCorrelation() { CorrelationCalculator calc = new CorrelationCalculator(); calc.AddData(this.GetMaleStudent(), this.GetUnsatisfactoryMark()); calc.AddData(this.GetFemaleStudent(), this.GetExcellentMark()); Assert.AreEqual(+1.0d, (double)calc.ComputeCorrelation()); }
public void Handle() { this.calculator = new CorrelationCalculator(); LoginRequest lr = new LoginRequest("viea16u008", "[password here]"); lr.Perform(); this.client = lr.Client; MainPageRequest mpr = new MainPageRequest(client); mpr.Perform(); EUMainPageRequest eumpr = new EUMainPageRequest(client, mpr.EULink); eumpr.Perform(); this.sessionCache = new SessionCache(this.client, eumpr.SessionLink); EUProgressPageRequest euppr = new EUProgressPageRequest(client, eumpr.ProgressLink); euppr.Perform(); logger.Log("Начинаем..."); var semesters = euppr.SemesterLinks; logger.SetStepsCount(semesters.Count - 1); foreach (var semester in semesters) { if (semester.Year > 2016) { break; } HandleSemester(semester); logger.Step(); } double result = calculator.ComputeCorrelation(); // " (+1 это перекос в сторону отличных оценок у девушек, -1 - у парней) logger.LogCorrelation(result); }