public GetValue ( System.DateTime date ) : |
||
date | System.DateTime | |
Résultat |
public void ShouldGetAverageHistoryValueForUndefinedDate() { var historyValues = new Line(getTestValues()); Assert.That(historyValues.GetValue(DateTime.Today.AddDays(-6)).Value, Is.EqualTo(500D)); Assert.That(historyValues.GetValue(DateTime.Today.AddDays(-5)).Value, Is.EqualTo(400D)); Assert.That(historyValues.GetValue(DateTime.Today.AddDays(-4)).Value, Is.EqualTo(300D)); Assert.That(historyValues.GetValue(DateTime.Today.AddDays(-3)).Value, Is.EqualTo(200D)); Assert.That(historyValues.GetValue(DateTime.Today.AddDays(-2)).Value, Is.EqualTo(100D)); Assert.That(historyValues.GetValue(DateTime.Today.AddDays(-1)).Value, Is.EqualTo(200D)); Assert.That(historyValues.GetValue(DateTime.Today).Value, Is.EqualTo(300D)); Assert.Throws<IndexOutOfRangeException>(() => historyValues.GetValue(DateTime.Today.AddDays(-7))); Assert.Throws<IndexOutOfRangeException>(() => historyValues.GetValue(DateTime.Today.AddDays(1))); }
public void shouldThrowWhenThereAreNoValuePoints() { ILine emptyline = new Line(); Assert.Throws<NoValuesOnLineException>(() => emptyline.GetValuePoints()); Assert.Throws<NoValuesOnLineException>(() => emptyline.GetValue(DateTime.Now)); Assert.Throws<NoValuesOnLineException>(() => emptyline.GetFirstDate()); Assert.Throws<NoValuesOnLineException>(() => emptyline.GetLastDate()); }