mirror of
https://github.com/lidarr/lidarr.git
synced 2025-07-30 19:50:15 -07:00
App_Data added to .gitignore
Added SetValue to ConfigFileProvider. Added creating of default config file in ConfigFileProvider. Added more ConfigFileProvider tests. Added UI for Settings/System
This commit is contained in:
parent
f0f706b32c
commit
ec6a0e6b7f
9 changed files with 185 additions and 3 deletions
|
@ -1,4 +1,5 @@
|
|||
using AutoMoq;
|
||||
using System.IO;
|
||||
using AutoMoq;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
|
@ -11,6 +12,17 @@ namespace NzbDrone.Core.Test
|
|||
// ReSharper disable InconsistentNaming
|
||||
public class ConfigFileProviderTest : TestBase
|
||||
{
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
//Reset config file
|
||||
var mocker = new AutoMoqer();
|
||||
var configFile = mocker.Resolve<ConfigFileProvider>().ConfigFile;
|
||||
File.Delete(configFile);
|
||||
|
||||
mocker.Resolve<ConfigFileProvider>().CreateDefaultConfigFile();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GetValue_Success()
|
||||
{
|
||||
|
@ -80,5 +92,37 @@ namespace NzbDrone.Core.Test
|
|||
//Assert
|
||||
result.Should().Be(value);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SetValue_bool()
|
||||
{
|
||||
const string key = "LaunchBrowser";
|
||||
const bool value = false;
|
||||
|
||||
var mocker = new AutoMoqer();
|
||||
|
||||
//Act
|
||||
mocker.Resolve<ConfigFileProvider>().SetValue(key, value);
|
||||
|
||||
//Assert
|
||||
var result = mocker.Resolve<ConfigFileProvider>().LaunchBrowser;
|
||||
result.Should().Be(value);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SetValue_int()
|
||||
{
|
||||
const string key = "Port";
|
||||
const int value = 12345;
|
||||
|
||||
var mocker = new AutoMoqer();
|
||||
|
||||
//Act
|
||||
mocker.Resolve<ConfigFileProvider>().SetValue(key, value);
|
||||
|
||||
//Assert
|
||||
var result = mocker.Resolve<ConfigFileProvider>().Port;
|
||||
result.Should().Be(value);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue