minor updates to test project

pull/2/head
kay.one 14 years ago
parent d3be516fb2
commit a6fe8b276b

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

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

@ -25,7 +25,7 @@ namespace NzbDrone.Core.Test
var fakeEpisode = Builder<Episode>.CreateNew().With(c => c.SeriesId = 69).Build();
//Act
var repo = MockLib.GetEmptyRepository();
var repo = MockLib.GetEmptyRepository(true);
repo.Add(fakeSeries);
repo.Add(fakeEpisode);
var fetchedSeries = repo.Single<Series>(fakeSeries.SeriesId);
@ -42,32 +42,40 @@ namespace NzbDrone.Core.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 fakeEpisode = Builder<Episode>.CreateNew().With(c => c.SeriesId = 69).Build();
//Act
var repo = MockLib.GetEmptyRepository(true);
repo.Add(fakeSeries);
repo.Add(fakeEpisode);
Console.WriteLine("Getting single");
var fetchedEpisode = repo.Single<Episode>(fakeEpisode.EpisodeId);
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
var result = repo.Single<Episode>(episode.EpisodeId).ToString();
//Assert
Console.WriteLine("Doing assert");
Assert.AreEqual(fakeEpisode.EpisodeId, fetchedEpisode.EpisodeId);
Console.WriteLine("Doing assert");
Assert.AreEqual(fakeEpisode.Title, fetchedEpisode.Title);
Console.WriteLine("=======================");
var ttt = fetchedEpisode.Series;
Console.WriteLine("=======================");
var tttd = fetchedEpisode.Series;
Console.WriteLine("=======================");
//Assert.Contains(fetchedEpisode.ToString(), fakeSeries.Title);
Console.WriteLine(result);
result.Should().Contain(series.Title);
result.Should().Contain(episode.EpisodeNumber.ToString());
result.Should().Contain(episode.SeasonNumber.ToString());
}
@ -78,7 +86,7 @@ namespace NzbDrone.Core.Test
public void tvdbid_is_preserved()
{
//Arrange
var sonicRepo = MockLib.GetEmptyRepository();
var sonicRepo = MockLib.GetEmptyRepository(true);
var series = Builder<Series>.CreateNew().With(c => c.SeriesId = 18).Build();
//Act
@ -105,7 +113,7 @@ namespace NzbDrone.Core.Test
//setup
var message = Guid.NewGuid().ToString();
var sonicRepo = MockLib.GetEmptyRepository();
var sonicRepo = MockLib.GetEmptyRepository(true);
var sonicTarget = new SubsonicTarget(sonicRepo);
@ -138,7 +146,7 @@ namespace NzbDrone.Core.Test
//setup
var message = Guid.NewGuid().ToString();
var sonicRepo = MockLib.GetEmptyRepository();
var sonicRepo = MockLib.GetEmptyRepository(true);
var sonicTarget = new SubsonicTarget(sonicRepo);
LogManager.Configuration.AddTarget("DbLogger", sonicTarget);
@ -171,7 +179,7 @@ namespace NzbDrone.Core.Test
//setup
var message = String.Empty;
var sonicRepo = MockLib.GetEmptyRepository();
var sonicRepo = MockLib.GetEmptyRepository(true);
var sonicTarget = new SubsonicTarget(sonicRepo);
LogManager.Configuration.AddTarget("DbLogger", sonicTarget);

Loading…
Cancel
Save