mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 18:57:39 -07:00
lots of different things ;)
This commit is contained in:
parent
c42518b34e
commit
4ae268b8e5
71 changed files with 526 additions and 1229 deletions
65
NzbDrone.Common.Test/DiskProviderTests.cs
Normal file
65
NzbDrone.Common.Test/DiskProviderTests.cs
Normal file
|
@ -0,0 +1,65 @@
|
|||
// ReSharper disable InconsistentNaming
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace NzbDrone.Common.Test
|
||||
{
|
||||
[TestFixture]
|
||||
public class DiskProviderTests
|
||||
{
|
||||
DirectoryInfo BinFolder;
|
||||
DirectoryInfo BinFolderCopy;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
var binRoot = new DirectoryInfo(Directory.GetCurrentDirectory()).Parent.Parent;
|
||||
BinFolder = new DirectoryInfo(Path.Combine(binRoot.FullName, "bin"));
|
||||
BinFolderCopy = new DirectoryInfo(Path.Combine(binRoot.FullName, "bin_copy"));
|
||||
|
||||
if (BinFolderCopy.Exists)
|
||||
{
|
||||
BinFolderCopy.Delete(true);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CopyFolder_should_copy_folder()
|
||||
{
|
||||
//Act
|
||||
var diskProvider = new DiskProvider();
|
||||
diskProvider.CopyDirectory(BinFolder.FullName, BinFolderCopy.FullName);
|
||||
|
||||
//Assert
|
||||
BinFolder.Refresh();
|
||||
BinFolderCopy.Refresh();
|
||||
|
||||
BinFolder.GetFiles("*.*", SearchOption.AllDirectories)
|
||||
.Should().HaveSameCount(BinFolderCopy.GetFiles("*.*", SearchOption.AllDirectories));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CopyFolder_should_overright_existing_folder()
|
||||
{
|
||||
//Act
|
||||
var diskProvider = new DiskProvider();
|
||||
|
||||
diskProvider.CopyDirectory(BinFolder.FullName, BinFolderCopy.FullName);
|
||||
|
||||
//Delete Random File
|
||||
BinFolderCopy.GetFiles().First().Delete();
|
||||
|
||||
diskProvider.CopyDirectory(BinFolder.FullName, BinFolderCopy.FullName);
|
||||
|
||||
//Assert
|
||||
BinFolder.Refresh();
|
||||
BinFolderCopy.Refresh();
|
||||
|
||||
BinFolder.GetFiles("*.*", SearchOption.AllDirectories)
|
||||
.Should().HaveSameCount(BinFolderCopy.GetFiles("*.*", SearchOption.AllDirectories));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -40,5 +40,11 @@ namespace NzbDrone.Common.Test
|
|||
enviromentController.ApplicationPath.Should().NotBeBlank();
|
||||
Path.IsPathRooted(enviromentController.ApplicationPath).Should().BeTrue("Path is not rooted");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsProduction_should_return_false_when_run_within_nunit()
|
||||
{
|
||||
EnviromentProvider.IsProduction.Should().BeFalse();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
8
NzbDrone.Common.Test/Fixtures.cs
Normal file
8
NzbDrone.Common.Test/Fixtures.cs
Normal file
|
@ -0,0 +1,8 @@
|
|||
// ReSharper disable CheckNamespace
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
[SetUpFixture]
|
||||
public class Fixtures : LoggingFixtures
|
||||
{
|
||||
}
|
|
@ -21,6 +21,7 @@
|
|||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
|
@ -59,7 +60,9 @@
|
|||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DiskProviderTests.cs" />
|
||||
<Compile Include="EnviromentProviderTest.cs" />
|
||||
<Compile Include="Fixtures.cs" />
|
||||
<Compile Include="ProcessProviderTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ServiceControllerTests.cs" />
|
||||
|
@ -73,14 +76,15 @@
|
|||
<Project>{F2BE0FDF-6E47-4827-A420-DD4EF82407F8}</Project>
|
||||
<Name>NzbDrone.Common</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\NzbDrone.Test.Common\NzbDrone.Test.Common.csproj">
|
||||
<Project>{CADDFCE0-7509-4430-8364-2074E1EEFCA2}</Project>
|
||||
<Name>NzbDrone.Test.Common</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\NzbDrone.Test.Dummy\NzbDrone.Test.Dummy.csproj">
|
||||
<Project>{FAFB5948-A222-4CF6-AD14-026BE7564802}</Project>
|
||||
<Name>NzbDrone.Test.Dummy</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<WCFMetadata Include="Service References\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue