minor updates to test project

This commit is contained in:
kay.one 2011-06-04 10:59:09 -07:00
parent d3be516fb2
commit a6fe8b276b
3 changed files with 43 additions and 28 deletions

View File

@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<configuration> <configuration>
<appSettings>
<!-- Supported values: nunit, xunit and mstest -->
<add key="FluentAssertions.TestFramework" value="nunit"/>
</appSettings>
<system.data> <system.data>
<DbProviderFactories> <DbProviderFactories>
<remove invariant="System.Data.SQLite" /> <remove invariant="System.Data.SQLite" />

View File

@ -44,12 +44,15 @@ namespace NzbDrone.Core.Test.Framework
Console.WriteLine("Creating an empty SQLite database"); Console.WriteLine("Creating an empty SQLite database");
var provider = ProviderFactory.GetProvider("Data Source=" + Guid.NewGuid() + ".db;Version=3;New=True", var provider = ProviderFactory.GetProvider("Data Source=" + Guid.NewGuid() + ".db;Version=3;New=True",
"System.Data.SQLite"); "System.Data.SQLite");
var repo = new SimpleRepository(provider, SimpleRepositoryOptions.RunMigrations);
ForceMigration(repo);
if (enableLogging) if (enableLogging)
{ {
provider.Log = new NlogWriter(); provider.Log = new NlogWriter();
} }
var repo = new SimpleRepository(provider, SimpleRepositoryOptions.RunMigrations);
ForceMigration(repo);
return repo; return repo;
} }

View File

@ -25,7 +25,7 @@ namespace NzbDrone.Core.Test
var fakeEpisode = Builder<Episode>.CreateNew().With(c => c.SeriesId = 69).Build(); var fakeEpisode = Builder<Episode>.CreateNew().With(c => c.SeriesId = 69).Build();
//Act //Act
var repo = MockLib.GetEmptyRepository(); var repo = MockLib.GetEmptyRepository(true);
repo.Add(fakeSeries); repo.Add(fakeSeries);
repo.Add(fakeEpisode); repo.Add(fakeEpisode);
var fetchedSeries = repo.Single<Series>(fakeSeries.SeriesId); var fetchedSeries = repo.Single<Series>(fakeSeries.SeriesId);
@ -42,32 +42,40 @@ namespace NzbDrone.Core.Test
} }
[Test] [Test]
public void ToString_test_over_castle_proxy() [Ignore]
public void query_scratch_pad()
{ {
//Arrange
var fakeSeries = Builder<Series>.CreateNew().With(s => s.SeriesId = 69).Build(); var repo = MockLib.GetEmptyRepository(true);
var fakeEpisode = Builder<Episode>.CreateNew().With(c => c.SeriesId = 69).Build();
repo.All<Episode>().Where(e => !e.Ignored && e.AirDate <= DateTime.Today && e.AirDate.Year > 1900).Select(
s => s.Title).ToList();
}
[Test]
[Ignore]
public void episode_proxy_to_string()
{
var episode = Builder<Episode>.CreateNew()
.Build();
var series = Builder<Series>.CreateNew()
.With(s => s.SeriesId = episode.SeriesId)
.Build();
var repo = MockLib.GetEmptyRepository(true);
repo.Add(episode);
repo.Add(series);
//Act //Act
var repo = MockLib.GetEmptyRepository(true);
repo.Add(fakeSeries); var result = repo.Single<Episode>(episode.EpisodeId).ToString();
repo.Add(fakeEpisode);
Console.WriteLine("Getting single");
var fetchedEpisode = repo.Single<Episode>(fakeEpisode.EpisodeId);
//Assert //Assert
Console.WriteLine("Doing assert"); Console.WriteLine(result);
Assert.AreEqual(fakeEpisode.EpisodeId, fetchedEpisode.EpisodeId); result.Should().Contain(series.Title);
Console.WriteLine("Doing assert"); result.Should().Contain(episode.EpisodeNumber.ToString());
Assert.AreEqual(fakeEpisode.Title, fetchedEpisode.Title); result.Should().Contain(episode.SeasonNumber.ToString());
Console.WriteLine("=======================");
var ttt = fetchedEpisode.Series;
Console.WriteLine("=======================");
var tttd = fetchedEpisode.Series;
Console.WriteLine("=======================");
//Assert.Contains(fetchedEpisode.ToString(), fakeSeries.Title);
} }
@ -78,7 +86,7 @@ namespace NzbDrone.Core.Test
public void tvdbid_is_preserved() public void tvdbid_is_preserved()
{ {
//Arrange //Arrange
var sonicRepo = MockLib.GetEmptyRepository(); var sonicRepo = MockLib.GetEmptyRepository(true);
var series = Builder<Series>.CreateNew().With(c => c.SeriesId = 18).Build(); var series = Builder<Series>.CreateNew().With(c => c.SeriesId = 18).Build();
//Act //Act
@ -105,7 +113,7 @@ namespace NzbDrone.Core.Test
//setup //setup
var message = Guid.NewGuid().ToString(); var message = Guid.NewGuid().ToString();
var sonicRepo = MockLib.GetEmptyRepository(); var sonicRepo = MockLib.GetEmptyRepository(true);
var sonicTarget = new SubsonicTarget(sonicRepo); var sonicTarget = new SubsonicTarget(sonicRepo);
@ -138,7 +146,7 @@ namespace NzbDrone.Core.Test
//setup //setup
var message = Guid.NewGuid().ToString(); var message = Guid.NewGuid().ToString();
var sonicRepo = MockLib.GetEmptyRepository(); var sonicRepo = MockLib.GetEmptyRepository(true);
var sonicTarget = new SubsonicTarget(sonicRepo); var sonicTarget = new SubsonicTarget(sonicRepo);
LogManager.Configuration.AddTarget("DbLogger", sonicTarget); LogManager.Configuration.AddTarget("DbLogger", sonicTarget);
@ -171,7 +179,7 @@ namespace NzbDrone.Core.Test
//setup //setup
var message = String.Empty; var message = String.Empty;
var sonicRepo = MockLib.GetEmptyRepository(); var sonicRepo = MockLib.GetEmptyRepository(true);
var sonicTarget = new SubsonicTarget(sonicRepo); var sonicTarget = new SubsonicTarget(sonicRepo);
LogManager.Configuration.AddTarget("DbLogger", sonicTarget); LogManager.Configuration.AddTarget("DbLogger", sonicTarget);