Added Auth, startup options to UI

Added caching to ConfigFileProvider,
This commit is contained in:
kay.one 2013-05-22 22:12:01 -07:00
commit 4da6654440
34 changed files with 579 additions and 365 deletions

View file

@ -1,4 +1,5 @@
using FluentAssertions;
using System.Collections.Generic;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Common.Cache;
@ -59,6 +60,21 @@ namespace NzbDrone.Common.Test.CacheTests
{
_cachedString.Remove("Test");
}
[Test]
public void get_without_callback_should_throw_on_invalid_key()
{
Assert.Throws<KeyNotFoundException>(() => _cachedString.Get("InvalidKey"));
}
[Test]
public void should_be_able_to_update_key()
{
_cachedString.Set("Key", "Old");
_cachedString.Set("Key", "New");
_cachedString.Get("Key").Should().Be("New");
}
}
public class Worker

View file

@ -2,16 +2,17 @@ using System;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Common.Cache;
using NzbDrone.Test.Common;
namespace NzbDrone.Common.Test.CacheTests
{
[TestFixture]
public class CachedManagerFixture
public class CachedManagerFixture:TestBase<ICacheManger>
{
[Test]
public void should_return_proper_type_of_cache()
{
var result = CacheManger.GetCache<DateTime>(typeof(string));
var result = Subject.GetCache<DateTime>(typeof(string));
result.Should().BeOfType<Cached<DateTime>>();
}
@ -20,8 +21,8 @@ namespace NzbDrone.Common.Test.CacheTests
[Test]
public void multiple_calls_should_get_the_same_cache()
{
var result1 = CacheManger.GetCache<DateTime>(typeof(string));
var result2 = CacheManger.GetCache<DateTime>(typeof(string));
var result1 = Subject.GetCache<DateTime>(typeof(string));
var result2 = Subject.GetCache<DateTime>(typeof(string));
result1.Should().BeSameAs(result2);
}

View file

@ -2,6 +2,7 @@
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Common.Model;
using NzbDrone.Core.Configuration;
using NzbDrone.Test.Common;
namespace NzbDrone.Common.Test
@ -143,15 +144,18 @@ namespace NzbDrone.Common.Test
}
[Test]
public void Guid_should_return_the_same_every_time()
public void SaveDictionary_should_save_proper_value()
{
int port = 20555;
var firstResponse = Subject.Guid;
var secondResponse = Subject.Guid;
var dic = Subject.GetConfigDictionary();
dic["Port"] = 20555;
Subject.SaveConfigDictionary(dic);
secondResponse.Should().Be(firstResponse);
Subject.Port.Should().Be(port);
}
}
}