public void AddInPlace() { DecayingDouble d = new DecayingDouble(4, FirstDayOfCentury); d.AddInPlace(OneDay, 3, TwoDaysLater); Assert.InRange(d.ValueAtTimeOfLastUpdate, 3.99999, 4.000001); double shouldBeVeryCloseTo1 = d.GetValue(OneDay, FourDaysLater); Assert.InRange(shouldBeVeryCloseTo1, .99999, 1.000001); }
public double[] GetAllScores(TimeSpan halfLife, DateTime whenUtc) { return(new double[] { SuccessfulLogins.GetValue(halfLife, whenUtc), AccountFailuresInfrequentPassword.GetValue(halfLife, whenUtc), AccountFailuresFrequentPassword.GetValue(halfLife, whenUtc), RepeatAccountFailuresInfrequentPassword.GetValue(halfLife, whenUtc), RepeatAccountFailuresFrequentPassword.GetValue(halfLife, whenUtc), PasswordFailuresNoTypoInfrequentPassword.GetValue(halfLife, whenUtc), PasswordFailuresNoTypoFrequentPassword.GetValue(halfLife, whenUtc), PasswordFailuresTypoInfrequentPassword.GetValue(halfLife, whenUtc), PasswordFailuresTypoFrequentPassword.GetValue(halfLife, whenUtc), RepeatPasswordFailuresNoTypoInfrequentPassword.GetValue(halfLife, whenUtc), RepeatPasswordFailuresNoTypoFrequentPassword.GetValue(halfLife, whenUtc), RepeatPasswordFailuresTypoInfrequentPassword.GetValue(halfLife, whenUtc), RepeatPasswordFailuresTypoFrequentPassword.GetValue(halfLife, whenUtc) }); }