1
0
mirror of https://github.com/Radarr/Radarr.git synced 2026-04-24 22:35:49 -04:00

Swap to dapper and system.text.json for database backend

This commit is contained in:
ta264
2019-12-15 15:04:42 +00:00
parent 7b17c3e36c
commit d2065bfa1b
155 changed files with 2333 additions and 2340 deletions
@@ -1,6 +1,5 @@
using System;
using System.Data.SQLite;
using FluentAssertions;
using Marr.Data.Converters;
using NUnit.Framework;
using NzbDrone.Common.Disk;
using NzbDrone.Core.Datastore.Converters;
@@ -12,13 +11,22 @@ namespace NzbDrone.Core.Test.Datastore.Converters
[TestFixture]
public class OsPathConverterFixture : CoreTest<OsPathConverter>
{
SQLiteParameter param;
[SetUp]
public void Setup()
{
param = new SQLiteParameter();
}
[Test]
public void should_return_string_when_saving_os_path_to_db()
{
var path = @"C:\Test\TV".AsOsAgnostic();
var osPath = new OsPath(path);
Subject.ToDB(osPath).Should().Be(path);
Subject.SetValue(param, osPath);
param.Value.Should().Be(path);
}
[Test]
@@ -27,23 +35,13 @@ namespace NzbDrone.Core.Test.Datastore.Converters
var path = @"C:\Test\TV".AsOsAgnostic();
var osPath = new OsPath(path);
var context = new ConverterContext
{
DbValue = path
};
Subject.FromDB(context).Should().Be(osPath);
Subject.Parse(path).Should().Be(osPath);
}
[Test]
public void should_return_db_null_for_db_null_value_when_getting_from_db()
public void should_return_empty_for_null_value_when_getting_from_db()
{
var context = new ConverterContext
{
DbValue = DBNull.Value
};
Subject.FromDB(context).Should().Be(DBNull.Value);
Subject.Parse(null).IsEmpty.Should().BeTrue();
}
}
}