Added Tests for DateTime Fluent.

This commit is contained in:
Mark McDowall 2011-09-28 10:12:53 -07:00
parent 9271b39787
commit f014ddcfea
1 changed files with 52 additions and 0 deletions

View File

@ -38,6 +38,58 @@ namespace NzbDrone.Core.Test
"test".WithDefault(null); "test".WithDefault(null);
} }
[Test]
public void ToBestDateTime_Yesterday()
{
var dateTime = DateTime.Today.AddDays(-1);
dateTime.ToBestDateString().Should().Be("Yesterday");
}
[Test]
public void ToBestDateTime_Today()
{
var dateTime = DateTime.Today;
dateTime.ToBestDateString().Should().Be("Today");
}
[Test]
public void ToBestDateTime_Tomorrow()
{
var dateTime = DateTime.Today.AddDays(1);
dateTime.ToBestDateString().Should().Be("Tomorrow");
}
[Test]
public void ToBestDateTime_DayOfWeek()
{
for (int i = 2; i < 7; i++)
{
var dateTime = DateTime.Today.AddDays(i);
Console.WriteLine(dateTime.DayOfWeek);
dateTime.ToBestDateString().Should().Be(dateTime.DayOfWeek.ToString());
}
}
[Test]
public void ToBestDateTime_Over_One_Week()
{
var dateTime = DateTime.Today.AddDays(8);
Console.WriteLine(dateTime.DayOfWeek);
dateTime.ToBestDateString().Should().Be(dateTime.ToShortDateString());
}
[Test]
public void ToBestDateTime_Before_Yesterday()
{
var dateTime = DateTime.Today.AddDays(-2);
Console.WriteLine(dateTime.DayOfWeek);
dateTime.ToBestDateString().Should().Be(dateTime.ToShortDateString());
}
} }
} }