mirror of
https://github.com/Radarr/Radarr
synced 2024-12-26 17:59:14 +00:00
added some test for free space.
This commit is contained in:
parent
47e29abc27
commit
76c7d75c31
3 changed files with 55 additions and 14 deletions
40
NzbDrone.Common.Test/DiskProviderTests/FreeSpaceFixture.cs
Normal file
40
NzbDrone.Common.Test/DiskProviderTests/FreeSpaceFixture.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Common.Test.DiskProviderTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class IsParentFixture : TestBase<DiskProvider>
|
||||
{
|
||||
private string _parent = @"C:\Test".AsOsAgnostic();
|
||||
|
||||
[Test]
|
||||
public void should_return_false_when_not_a_child()
|
||||
{
|
||||
var path = @"C:\Another Folder".AsOsAgnostic();
|
||||
|
||||
Subject.IsParent(_parent, path).Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_true_when_folder_is_parent_of_another_folder()
|
||||
{
|
||||
var path = @"C:\Test\TV".AsOsAgnostic();
|
||||
|
||||
Subject.IsParent(_parent, path).Should().BeTrue();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_true_when_folder_is_parent_of_a_file()
|
||||
{
|
||||
var path = @"C:\Test\30.Rock.S01E01.Pilot.avi".AsOsAgnostic();
|
||||
|
||||
Subject.IsParent(_parent, path).Should().BeTrue();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using FluentAssertions;
|
||||
|
@ -9,32 +10,31 @@
|
|||
namespace NzbDrone.Common.Test.DiskProviderTests
|
||||
{
|
||||
[TestFixture]
|
||||
public class IsParentFixture : TestBase<DiskProvider>
|
||||
public class FreeSpaceFixture : TestBase<DiskProvider>
|
||||
{
|
||||
private string _parent = @"C:\Test".AsOsAgnostic();
|
||||
|
||||
[Test]
|
||||
public void should_return_false_when_not_a_child()
|
||||
public void should_get_free_space_for_folder()
|
||||
{
|
||||
var path = @"C:\Another Folder".AsOsAgnostic();
|
||||
var path = @"C:\".AsOsAgnostic();
|
||||
|
||||
Subject.IsParent(_parent, path).Should().BeFalse();
|
||||
Subject.GetAvilableSpace(path).Should().NotBe(0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_true_when_folder_is_parent_of_another_folder()
|
||||
public void should_get_free_space_for_folder_that_doesnt_exist()
|
||||
{
|
||||
var path = @"C:\Test\TV".AsOsAgnostic();
|
||||
var path = @"C:\".AsOsAgnostic();
|
||||
|
||||
Subject.IsParent(_parent, path).Should().BeTrue();
|
||||
Subject.GetAvilableSpace(Path.Combine(path, "invalidFolder")).Should().NotBe(0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_return_true_when_folder_is_parent_of_a_file()
|
||||
{
|
||||
var path = @"C:\Test\30.Rock.S01E01.Pilot.avi".AsOsAgnostic();
|
||||
|
||||
Subject.IsParent(_parent, path).Should().BeTrue();
|
||||
[Test]
|
||||
public void should_get_free_space_for_drive_that_doesnt_exist()
|
||||
{
|
||||
WindowsOnly();
|
||||
|
||||
Subject.GetAvilableSpace("J:\\").Should().NotBe(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
<Compile Include="CacheTests\CachedManagerFixture.cs" />
|
||||
<Compile Include="CacheTests\CachedFixture.cs" />
|
||||
<Compile Include="ConfigFileProviderTest.cs" />
|
||||
<Compile Include="DiskProviderTests\FreeSpaceFixture.cs" />
|
||||
<Compile Include="DiskProviderTests\IsParentFixture.cs" />
|
||||
<Compile Include="EnsureTest\PathExtensionFixture.cs" />
|
||||
<Compile Include="EnvironmentTests\StartupArgumentsFixture.cs" />
|
||||
|
|
Loading…
Reference in a new issue