mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-21 22:05:43 -04:00
@@ -0,0 +1,74 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using FizzWare.NBuilder;
|
||||
using FluentAssertions;
|
||||
using NUnit.Framework;
|
||||
using NzbDrone.Core.Test.Framework;
|
||||
using NzbDrone.Core.Tv;
|
||||
using NzbDrone.Core.Validation.Paths;
|
||||
using NzbDrone.Test.Common;
|
||||
|
||||
namespace NzbDrone.Core.Test.ValidationTests
|
||||
{
|
||||
public class SystemFolderValidatorFixture : CoreTest<SystemFolderValidator>
|
||||
{
|
||||
private TestValidator<Series> _validator;
|
||||
|
||||
[SetUp]
|
||||
public void Setup()
|
||||
{
|
||||
_validator = new TestValidator<Series>
|
||||
{
|
||||
v => v.RuleFor(s => s.Path).SetValidator(Subject)
|
||||
};
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_be_valid_if_set_to_windows_folder()
|
||||
{
|
||||
WindowsOnly();
|
||||
|
||||
var series = Builder<Series>.CreateNew()
|
||||
.With(s => s.Path = Environment.GetFolderPath(Environment.SpecialFolder.Windows))
|
||||
.Build();
|
||||
|
||||
_validator.Validate(series).IsValid.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_be_valid_if_child_of_windows_folder()
|
||||
{
|
||||
WindowsOnly();
|
||||
|
||||
var series = Builder<Series>.CreateNew()
|
||||
.With(s => s.Path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "Test"))
|
||||
.Build();
|
||||
|
||||
_validator.Validate(series).IsValid.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_be_valid_if_set_to_bin_folder()
|
||||
{
|
||||
MonoOnly();
|
||||
|
||||
var series = Builder<Series>.CreateNew()
|
||||
.With(s => s.Path = "/bin")
|
||||
.Build();
|
||||
|
||||
_validator.Validate(series).IsValid.Should().BeFalse();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_be_valid_if_child_of_bin_folder()
|
||||
{
|
||||
MonoOnly();
|
||||
|
||||
var series = Builder<Series>.CreateNew()
|
||||
.With(s => s.Path = "/bin/test")
|
||||
.Build();
|
||||
|
||||
_validator.Validate(series).IsValid.Should().BeFalse();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user