You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Sonarr/src/NzbDrone.Core.Test/Datastore/Migration/109_import_extra_files_conf...

53 lines
1.5 KiB

using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Core.Datastore.Migration;
using NzbDrone.Core.Test.Framework;
namespace NzbDrone.Core.Test.Datastore.Migration
{
[TestFixture]
public class import_extra_files_configFixture : MigrationTest<import_extra_files>
{
[Test]
public void should_not_insert_if_missing()
{
var db = WithMigrationTestDb();
var items = db.QueryScalar<string>("SELECT \"Value\" FROM \"Config\" WHERE \"Key\" = 'importextrafiles'");
items.Should().BeNull();
}
[Test]
public void should_not_insert_if_empty()
{
var db = WithMigrationTestDb(c =>
{
c.Insert.IntoTable("Config").Row(new
{
Key = "extrafileextensions",
Value = ""
});
});
var items = db.QueryScalar<string>("SELECT \"Value\" FROM \"Config\" WHERE \"Key\" = 'importextrafiles'");
items.Should().BeNull();
}
[Test]
public void should_insert_True_if_configured()
{
var db = WithMigrationTestDb(c =>
{
c.Insert.IntoTable("Config").Row(new
{
Key = "extrafileextensions",
Value = "srt"
});
});
var items = db.QueryScalar<string>("SELECT \"Value\" FROM \"Config\" WHERE \"Key\" = 'importextrafiles'");
items.Should().Be("True");
}
}
}