Lidarr/src/NzbDrone.Common.Test/EnsureTest/PathExtensionFixture.cs
Mark McDowall d0f75e2e96 New: Improve path validation when handling paths from different OSes
(cherry picked from commit 0321368cc392d7a0a488409bf6bd586ba45497af)

Closes #3466
2023-05-06 16:00:23 +03:00

26 lines
767 B
C#

using NUnit.Framework;
using NzbDrone.Common.Disk;
using NzbDrone.Common.EnsureThat;
using NzbDrone.Test.Common;
namespace NzbDrone.Common.Test.EnsureTest
{
[TestFixture]
public class PathExtensionFixture : TestBase
{
[TestCase(@"p:\Music\file with, comma.mp3")]
[TestCase(@"\\serer\share\file with, comma.mp3")]
public void EnsureWindowsPath(string path)
{
WindowsOnly();
Ensure.That(path, () => path).IsValidPath(PathValidationType.CurrentOs);
}
[TestCase(@"/var/user/file with, comma.mp3")]
public void EnsureLinuxPath(string path)
{
PosixOnly();
Ensure.That(path, () => path).IsValidPath(PathValidationType.CurrentOs);
}
}
}