mirror of https://github.com/Radarr/Radarr
More NzbDrone.Common updates
This commit is contained in:
parent
6828f099bc
commit
c42518b34e
|
@ -63,6 +63,7 @@
|
||||||
<Compile Include="ProcessProviderTests.cs" />
|
<Compile Include="ProcessProviderTests.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="ServiceControllerTests.cs" />
|
<Compile Include="ServiceControllerTests.cs" />
|
||||||
|
<Compile Include="WebClientTests.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
// ReSharper disable InconsistentNaming
|
||||||
|
using FluentAssertions;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace NzbDrone.Common.Test
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class WebClientTests
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void DownloadString_should_be_able_to_download_jquery()
|
||||||
|
{
|
||||||
|
var jquery = new WebClientProvider().DownloadString("http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js");
|
||||||
|
|
||||||
|
jquery.Should().NotBeBlank();
|
||||||
|
jquery.Should().Contain("function(a,b)");
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestCase("")]
|
||||||
|
[TestCase("http://")]
|
||||||
|
[TestCase(null)]
|
||||||
|
[ExpectedException]
|
||||||
|
public void DownloadString_should_throw_on_error(string url)
|
||||||
|
{
|
||||||
|
var jquery = new WebClientProvider().DownloadString(url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,7 +4,7 @@ using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
|
|
||||||
namespace NzbDrone.Update.Providers
|
namespace NzbDrone.Common
|
||||||
{
|
{
|
||||||
public class DiskProvider
|
public class DiskProvider
|
||||||
{
|
{
|
|
@ -46,6 +46,7 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="ConsoleProvider.cs" />
|
<Compile Include="ConsoleProvider.cs" />
|
||||||
|
<Compile Include="DiskProvider.cs" />
|
||||||
<Compile Include="EnviromentProvider.cs" />
|
<Compile Include="EnviromentProvider.cs" />
|
||||||
<Compile Include="Model\ProcessInfo.cs" />
|
<Compile Include="Model\ProcessInfo.cs" />
|
||||||
<Compile Include="ProcessProvider.cs" />
|
<Compile Include="ProcessProvider.cs" />
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using AutoMoq;
|
using AutoMoq;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
|
using Moq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
using NzbDrone.Update.Providers;
|
using NzbDrone.Update.Providers;
|
||||||
|
@ -59,5 +60,19 @@ namespace NzbDrone.Update.Test
|
||||||
Assert.Throws<DirectoryNotFoundException>(() => mocker.Resolve<UpdateProvider>().Verify(targetFolder))
|
Assert.Throws<DirectoryNotFoundException>(() => mocker.Resolve<UpdateProvider>().Verify(targetFolder))
|
||||||
.Message.Should().StartWith("Update folder doesn't exist");
|
.Message.Should().StartWith("Update folder doesn't exist");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void verify_should_pass_if_update_folder_and_target_folder_both_exist()
|
||||||
|
{
|
||||||
|
const string targetFolder = "c:\\NzbDrone\\";
|
||||||
|
|
||||||
|
mocker.GetMock<DiskProvider>()
|
||||||
|
.Setup(c => c.FolderExists(It.IsAny<string>()))
|
||||||
|
.Returns(true);
|
||||||
|
|
||||||
|
mocker.Resolve<UpdateProvider>().Verify(targetFolder);
|
||||||
|
|
||||||
|
mocker.VerifyAllMocks();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,6 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Providers\DiskProvider.cs" />
|
|
||||||
<Compile Include="Providers\UpdateProvider.cs" />
|
<Compile Include="Providers\UpdateProvider.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
Loading…
Reference in New Issue