fixed broken test
This commit is contained in:
parent
5c08e423a5
commit
370ab86dca
|
@ -13,64 +13,64 @@ namespace NzbDrone.Core.Test.Datastore
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class DatabaseRelationshipFixture : DbTest
|
public class DatabaseRelationshipFixture : DbTest
|
||||||
{
|
{
|
||||||
/* [Test]
|
/* [Test]
|
||||||
[Explicit]
|
[Explicit]
|
||||||
public void benchmark()
|
public void benchmark()
|
||||||
{
|
{
|
||||||
var series = Builder<Series>.CreateNew()
|
var series = Builder<Series>.CreateNew()
|
||||||
.With(c => c.Id = 0)
|
.With(c => c.Id = 0)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
Marr.Data.MapRepository.Instance.EnableTraceLogging = false;
|
Marr.Data.MapRepository.Instance.EnableTraceLogging = false;
|
||||||
|
|
||||||
Db.Insert(series);
|
Db.Insert(series);
|
||||||
|
|
||||||
var covers = Builder<MediaCover.MediaCover>.CreateListOfSize(5)
|
var covers = Builder<MediaCover.MediaCover>.CreateListOfSize(5)
|
||||||
.All()
|
.All()
|
||||||
.With(c => c.SeriesId = series.Id)
|
.With(c => c.SeriesId = series.Id)
|
||||||
.With(c => c.Id = 0)
|
.With(c => c.Id = 0)
|
||||||
.Build()
|
.Build()
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
Db.InsertMany(covers);
|
Db.InsertMany(covers);
|
||||||
|
|
||||||
var loadedSeries = Db.Single<Series>();
|
var loadedSeries = Db.Single<Series>();
|
||||||
|
|
||||||
var sw = Stopwatch.StartNew();
|
var sw = Stopwatch.StartNew();
|
||||||
for (int i = 0; i < 10000; i++)
|
for (int i = 0; i < 10000; i++)
|
||||||
{
|
{
|
||||||
loadedSeries = Db.Single<Series>();
|
loadedSeries = Db.Single<Series>();
|
||||||
var list = loadedSeries.Covers.Value;
|
var list = loadedSeries.Covers.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
sw.Stop();
|
sw.Stop();
|
||||||
|
|
||||||
Console.WriteLine(sw.Elapsed);
|
Console.WriteLine(sw.Elapsed);
|
||||||
|
|
||||||
loadedSeries.Covers.Value.Should().HaveSameCount(covers);
|
loadedSeries.Covers.Value.Should().HaveSameCount(covers);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void one_to_many()
|
public void one_to_many()
|
||||||
{
|
{
|
||||||
var series = Builder<Series>.CreateNew()
|
var series = Builder<Series>.CreateNew()
|
||||||
.With(c => c.Id = 0)
|
.With(c => c.Id = 0)
|
||||||
.Build();
|
.Build();
|
||||||
|
|
||||||
Db.Insert(series);
|
Db.Insert(series);
|
||||||
|
|
||||||
var covers = Builder<MediaCover.MediaCover>.CreateListOfSize(5)
|
var covers = Builder<MediaCover.MediaCover>.CreateListOfSize(5)
|
||||||
.All()
|
.All()
|
||||||
.With(c => c.SeriesId = series.Id)
|
.With(c => c.SeriesId = series.Id)
|
||||||
.With(c => c.Id = 0)
|
.With(c => c.Id = 0)
|
||||||
.Build()
|
.Build()
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
Db.InsertMany(covers);
|
Db.InsertMany(covers);
|
||||||
|
|
||||||
var loadedSeries = Db.Single<Series>();
|
var loadedSeries = Db.Single<Series>();
|
||||||
loadedSeries.Covers.Value.Should().HaveSameCount(covers);
|
loadedSeries.Covers.Value.Should().HaveSameCount(covers);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void one_to_one()
|
public void one_to_one()
|
||||||
|
@ -93,7 +93,7 @@ namespace NzbDrone.Core.Test.Datastore
|
||||||
var loadedEpisode = Db.Single<History.History>().Episode.Value;
|
var loadedEpisode = Db.Single<History.History>().Episode.Value;
|
||||||
|
|
||||||
loadedEpisode.Should().NotBeNull();
|
loadedEpisode.Should().NotBeNull();
|
||||||
loadedEpisode.ShouldHave().AllProperties().EqualTo(episode);
|
loadedEpisode.ShouldHave().AllProperties().But(c => c.SeriesTitle).EqualTo(episode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue