1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-16 11:37:58 +02:00
Sonarr/NzbDrone.Common.Test/DiskProviderTests/FreeSpaceFixture.cs

44 lines
1.1 KiB
C#
Raw Normal View History

2013-09-17 09:14:47 +03:00
using System.IO;
using FluentAssertions;
2013-08-30 04:55:42 +03:00
using NUnit.Framework;
using NzbDrone.Test.Common;
namespace NzbDrone.Common.Test.DiskProviderTests
{
[TestFixture]
2013-09-17 09:14:47 +03:00
public class FreeSpaceFixture : TestBase<DiskProvider>
2013-08-30 04:55:42 +03:00
{
[Test]
2013-09-17 09:14:47 +03:00
public void should_get_free_space_for_folder()
2013-08-30 04:55:42 +03:00
{
2013-09-17 09:14:47 +03:00
var path = @"C:\".AsOsAgnostic();
2013-08-30 04:55:42 +03:00
2013-09-17 09:14:47 +03:00
Subject.GetAvailableSpace(path).Should().NotBe(0);
2013-08-30 04:55:42 +03:00
}
[Test]
2013-09-17 09:14:47 +03:00
public void should_get_free_space_for_folder_that_doesnt_exist()
2013-08-30 04:55:42 +03:00
{
2013-09-17 09:14:47 +03:00
var path = @"C:\".AsOsAgnostic();
2013-08-30 04:55:42 +03:00
2013-09-17 09:14:47 +03:00
Subject.GetAvailableSpace(Path.Combine(path, "invalidFolder")).Should().NotBe(0);
2013-08-30 04:55:42 +03:00
}
2013-09-17 09:14:47 +03:00
2013-08-30 04:55:42 +03:00
[Test]
2013-09-17 09:14:47 +03:00
public void should_get_free_space_for_drive_that_doesnt_exist()
2013-08-30 04:55:42 +03:00
{
2013-09-17 09:14:47 +03:00
WindowsOnly();
Assert.Throws<DirectoryNotFoundException>(() => Subject.GetAvailableSpace("J:\\").Should().NotBe(0));
}
2013-08-30 04:55:42 +03:00
2013-09-17 09:14:47 +03:00
[Test]
public void should_be_able_to_check_space_on_ramdrive()
{
LinuxOnly();
Subject.GetAvailableSpace("/run/").Should().NotBe(0);
2013-08-30 04:55:42 +03:00
}
}
}