mirror of
https://github.com/Radarr/Radarr.git
synced 2024-07-15 00:57:36 +02:00
parent
9ca291ecaf
commit
13f3d0292c
@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using FizzWare.NBuilder;
|
using FizzWare.NBuilder;
|
||||||
using FluentAssertions;
|
using FluentAssertions;
|
||||||
@ -135,5 +135,24 @@ public void should_fix_wrong_slashes_on_add(string remotePath, string cleanedPat
|
|||||||
|
|
||||||
result.RemotePath.Should().Be(cleanedPath);
|
result.RemotePath.Should().Be(cleanedPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestCase(@" \\server\share\with\whitespace\ ", @"\\server\share\with\whitespace\")]
|
||||||
|
[TestCase(@" D:\with\whitespace\", @"D:\with\whitespace\")]
|
||||||
|
[TestCase(@"D:\with\whitespace\ ", @"D:\with\whitespace\")]
|
||||||
|
public void should_trim_whitespace_on_add(string remotePath, string cleanedPath)
|
||||||
|
{
|
||||||
|
GivenMapping();
|
||||||
|
|
||||||
|
var mapping = new RemotePathMapping
|
||||||
|
{
|
||||||
|
Host = "my-server.localdomain",
|
||||||
|
RemotePath = remotePath,
|
||||||
|
LocalPath = @"D:\mountedstorage\downloads\tv".AsOsAgnostic()
|
||||||
|
};
|
||||||
|
|
||||||
|
var result = Subject.Add(mapping);
|
||||||
|
|
||||||
|
result.RemotePath.Should().Be(cleanedPath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -50,8 +50,8 @@ public List<RemotePathMapping> All()
|
|||||||
|
|
||||||
public RemotePathMapping Add(RemotePathMapping mapping)
|
public RemotePathMapping Add(RemotePathMapping mapping)
|
||||||
{
|
{
|
||||||
mapping.LocalPath = new OsPath(mapping.LocalPath).AsDirectory().FullPath;
|
mapping.LocalPath = new OsPath(mapping.LocalPath.Trim()).AsDirectory().FullPath;
|
||||||
mapping.RemotePath = new OsPath(mapping.RemotePath).AsDirectory().FullPath;
|
mapping.RemotePath = new OsPath(mapping.RemotePath.Trim()).AsDirectory().FullPath;
|
||||||
|
|
||||||
var all = All();
|
var all = All();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user