mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-28 13:01:28 +02: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:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user