mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 14:03:29 -07:00
Moved duplicated NormalizePath method to PathExtentions
This commit is contained in:
parent
95d1832379
commit
6778a6ed99
9 changed files with 54 additions and 60 deletions
|
@ -1,4 +1,5 @@
|
|||
using System.Linq;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
|
@ -13,7 +14,7 @@ namespace NzbDrone.Common.Test
|
|||
private EnviromentProvider GetEnviromentProvider()
|
||||
{
|
||||
var envMoq = new Mock<EnviromentProvider>();
|
||||
|
||||
|
||||
envMoq.SetupGet(c => c.ApplicationPath).Returns(@"C:\NzbDrone\");
|
||||
|
||||
envMoq.SetupGet(c => c.SystemTemp).Returns(@"C:\Temp\");
|
||||
|
@ -21,6 +22,32 @@ namespace NzbDrone.Common.Test
|
|||
return envMoq.Object;
|
||||
}
|
||||
|
||||
[TestCase(@"c:\test\", @"c:\test")]
|
||||
[TestCase(@"c:\\test\\", @"c:\test")]
|
||||
[TestCase(@"C:\\Test\\", @"C:\Test")]
|
||||
[TestCase(@"C:\\Test\\Test\", @"C:\Test\Test")]
|
||||
[TestCase(@"\\Testserver\Test\", @"\\Testserver\Test")]
|
||||
public void Normalize_Path(string dirty, string clean)
|
||||
{
|
||||
var result = dirty.NormalizePath();
|
||||
result.Should().Be(clean);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException(typeof(ArgumentException), ExpectedMessage = "Path can not be null or empty")]
|
||||
public void normalize_path_exception_empty()
|
||||
{
|
||||
"".NormalizePath();
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException(typeof(ArgumentException), ExpectedMessage = "Path can not be null or empty")]
|
||||
public void normalize_path_exception_null()
|
||||
{
|
||||
string nullPath = null;
|
||||
nullPath.NormalizePath();
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void AppDataDirectory_path_test()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue