mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 02:37:08 -07:00
ConfigFileProvider will now add missing config values automatically, with a default value.
Added Handbrake and AtomicParsley wrappers for iPod video conversion.
This commit is contained in:
parent
d9b2c72125
commit
f973c74c87
9 changed files with 376 additions and 20 deletions
|
@ -2,6 +2,7 @@
|
|||
using AutoMoq;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Model;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
using NzbDrone.Core.Repository;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
|
@ -32,7 +33,7 @@ namespace NzbDrone.Core.Test
|
|||
var mocker = new AutoMoqer();
|
||||
|
||||
//Act
|
||||
var result = mocker.Resolve<ConfigFileProvider>().GetValue(key);
|
||||
var result = mocker.Resolve<ConfigFileProvider>().GetValue(key, value);
|
||||
|
||||
//Assert
|
||||
result.Should().Be(value);
|
||||
|
@ -47,7 +48,7 @@ namespace NzbDrone.Core.Test
|
|||
var mocker = new AutoMoqer();
|
||||
|
||||
//Act
|
||||
var result = mocker.Resolve<ConfigFileProvider>().GetValueInt(key);
|
||||
var result = mocker.Resolve<ConfigFileProvider>().GetValueInt(key, value);
|
||||
|
||||
//Assert
|
||||
result.Should().Be(value);
|
||||
|
@ -57,11 +58,12 @@ namespace NzbDrone.Core.Test
|
|||
public void GetBool_Success()
|
||||
{
|
||||
const string key = "LaunchBrowser";
|
||||
const bool value = true;
|
||||
|
||||
var mocker = new AutoMoqer();
|
||||
|
||||
//Act
|
||||
var result = mocker.Resolve<ConfigFileProvider>().GetValueBoolean(key);
|
||||
var result = mocker.Resolve<ConfigFileProvider>().GetValueBoolean(key, value);
|
||||
|
||||
//Assert
|
||||
result.Should().BeTrue();
|
||||
|
@ -124,5 +126,60 @@ namespace NzbDrone.Core.Test
|
|||
var result = mocker.Resolve<ConfigFileProvider>().Port;
|
||||
result.Should().Be(value);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetValue_New_Key()
|
||||
{
|
||||
const string key = "Hello";
|
||||
const string value = "World";
|
||||
|
||||
var mocker = new AutoMoqer();
|
||||
|
||||
//Act
|
||||
var result = mocker.Resolve<ConfigFileProvider>().GetValue(key, value);
|
||||
|
||||
//Assert
|
||||
result.Should().Be(value);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetValue_New_Key_with_new_parent()
|
||||
{
|
||||
const string key = "Hello";
|
||||
const string value = "World";
|
||||
|
||||
var mocker = new AutoMoqer();
|
||||
|
||||
//Act
|
||||
var result = mocker.Resolve<ConfigFileProvider>().GetValue(key, value, "Universe");
|
||||
|
||||
//Assert
|
||||
result.Should().Be(value);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetAuthenticationType_No_Existing_Value()
|
||||
{
|
||||
var mocker = new AutoMoqer();
|
||||
|
||||
//Act
|
||||
var result = mocker.Resolve<ConfigFileProvider>().AuthenticationType;
|
||||
|
||||
//Assert
|
||||
result.Should().Be(AuthenticationType.Anonymous);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetAuthenticationType_Windows()
|
||||
{
|
||||
var mocker = new AutoMoqer();
|
||||
mocker.Resolve<ConfigFileProvider>().SetValue("AuthenticationType", 1);
|
||||
|
||||
//Act
|
||||
var result = mocker.Resolve<ConfigFileProvider>().AuthenticationType;
|
||||
|
||||
//Assert
|
||||
result.Should().Be(AuthenticationType.Windows);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue