public void Empty() { var trend = new LinearTrend(); Assert.That(trend.Slope, Is.Null, "Slope"); Assert.That(trend.Offset, Is.Null, "Offset"); }
public void One() { var trend = new LinearTrend(); trend.Add(1, 1); Assert.That(trend.Slope, Is.EqualTo(0), "Slope"); Assert.That(trend.Offset, Is.EqualTo(1), "Offset"); }
public void Two_Increasing() { var trend = new LinearTrend(); trend.Add(1, 1); trend.Add(2, 2); Assert.That(trend.Slope, Is.EqualTo(1), "Slope"); Assert.That(trend.Offset, Is.EqualTo(0), "Offset"); }
public void Case_1() { var trend = new LinearTrend(); trend.Add(1, 1581); // +1581 trend.Add(2, 3915); // +2334 trend.Add(3, 5584); // +1669 // avg: +1861 Assert.That(trend.Slope, Is.EqualTo(2001.5), "Slope"); Assert.That(trend.Offset, Is.EqualTo(-310).Within(1), "Offset"); }