1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2025-03-05 15:15:59 +02:00

45 lines
1.1 KiB
C#
Raw Normal View History

using System.IO;
using FluentAssertions;
using NUnit.Framework;
using NzbDrone.Test.Common;
namespace NzbDrone.Common.Test.DiskProviderTests
{
[TestFixture]
2013-08-29 18:55:42 -07:00
public class FreeSpaceFixture : TestBase<DiskProvider>
{
[Test]
2013-08-29 18:55:42 -07:00
public void should_get_free_space_for_folder()
{
2013-08-29 18:55:42 -07:00
var path = @"C:\".AsOsAgnostic();
2013-08-11 21:57:10 -07:00
Subject.GetAvailableSpace(path).Should().NotBe(0);
}
[Test]
2013-08-29 18:55:42 -07:00
public void should_get_free_space_for_folder_that_doesnt_exist()
{
2013-08-29 18:55:42 -07:00
var path = @"C:\".AsOsAgnostic();
2013-08-11 21:57:10 -07:00
Subject.GetAvailableSpace(Path.Combine(path, "invalidFolder")).Should().NotBe(0);
}
2013-08-29 18:55:42 -07:00
[Test]
2013-08-29 18:55:42 -07:00
public void should_get_free_space_for_drive_that_doesnt_exist()
{
2013-08-29 18:55:42 -07:00
WindowsOnly();
2013-08-11 21:57:10 -07:00
Assert.Throws<DirectoryNotFoundException>(() => Subject.GetAvailableSpace("J:\\").Should().NotBe(0));
}
[Test]
public void should_return_null_when_cant_get_free_space()
{
LinuxOnly();
Subject.GetAvailableSpace("/run/").Should().NotBe(null);
}
}
}