1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-27 01:57:21 +00:00

Fixed tests to ensure they have different numbers for expected count vs unexpected.

This commit is contained in:
Mark McDowall 2011-11-22 17:09:06 -08:00
parent 6ae341373f
commit 519172dfab
2 changed files with 12 additions and 8 deletions

View file

@ -94,9 +94,9 @@ public void PurgeItem()
public void Trim_Items()
{
//Setup
var historyItem = Builder<History>.CreateListOfSize(20)
var historyItem = Builder<History>.CreateListOfSize(30)
.TheFirst(10).With(c => c.Date = DateTime.Now)
.TheNext(10).With(c => c.Date = DateTime.Now.AddDays(-31))
.TheNext(20).With(c => c.Date = DateTime.Now.AddDays(-31))
.Build();
var mocker = new AutoMoqer();
@ -107,11 +107,13 @@ public void Trim_Items()
//Act
db.Fetch<History>().Should().HaveCount(20);
db.Fetch<History>().Should().HaveCount(30);
mocker.Resolve<HistoryProvider>().Trim();
//Assert
db.Fetch<History>().Should().HaveCount(10);
var result = db.Fetch<History>();
result.Should().HaveCount(10);
result.Should().OnlyContain(s => s.Date > DateTime.Now.AddDays(-30));
}

View file

@ -227,8 +227,8 @@ public void pagedLogs()
public void Trim_Logs_should_clear_logs_older_than_30_days()
{
//Setup
var historyItem = Builder<Log>.CreateListOfSize(20)
.TheFirst(10).With(c => c.Time = DateTime.Now)
var historyItem = Builder<Log>.CreateListOfSize(30)
.TheFirst(20).With(c => c.Time = DateTime.Now)
.TheNext(10).With(c => c.Time = DateTime.Now.AddDays(-31))
.Build();
@ -239,11 +239,13 @@ public void Trim_Logs_should_clear_logs_older_than_30_days()
db.InsertMany(historyItem);
//Act
db.Fetch<Log>().Should().HaveCount(20);
db.Fetch<Log>().Should().HaveCount(30);
mocker.Resolve<LogProvider>().Trim();
//Assert
db.Fetch<Log>().Should().HaveCount(10);
var result = db.Fetch<Log>();
result.Should().HaveCount(20);
result.Should().OnlyContain(s => s.Time > DateTime.Now.AddDays(-30));
}
}
}