mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-19 21:13:28 -07:00
Added db4o.
Added guards against most problematic areas.
This commit is contained in:
parent
b6a4e6c32c
commit
5dbaaee005
11 changed files with 396 additions and 6 deletions
54
NzbDrone.Core.Test/Datastore/ObjectDatabaseFixture.cs
Normal file
54
NzbDrone.Core.Test/Datastore/ObjectDatabaseFixture.cs
Normal file
|
@ -0,0 +1,54 @@
|
|||
using System.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Repository.Quality;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using Db4objects.Db4o.Linq;
|
||||
|
||||
namespace NzbDrone.Core.Test.Datastore
|
||||
{
|
||||
[TestFixture]
|
||||
public class ObjectDatabaseFixture : CoreTest
|
||||
{
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
WithObjectDb();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_be_able_to_write_to_database()
|
||||
{
|
||||
|
||||
var series = Builder<Series>.CreateNew().Build();
|
||||
|
||||
ObjDb.Save(series);
|
||||
|
||||
ObjDb.Ext().Purge();
|
||||
|
||||
ObjDb.AsQueryable<Series>().Should().HaveCount(1);
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_store_dirty_data_in_cache()
|
||||
{
|
||||
var episode = Builder<Episode>.CreateNew().Build();
|
||||
|
||||
//Save series without episode attached
|
||||
ObjDb.Save(episode);
|
||||
|
||||
ObjDb.AsQueryable<Episode>().Single().Series.Should().BeNull();
|
||||
|
||||
episode.Series = Builder<Series>.CreateNew().Build();
|
||||
|
||||
ObjDb.AsQueryable<Episode>().Single().Series.Should().BeNull();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue