mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-01-15 14:53:37 +01:00
* Add TIOBE + include SonarAnalyzer.CSharp * . * cp * Copyright © WireMock.Net * more fixes * fix * xpath * if (Matchers == null || !Matchers.Any()) * if (Matchers != null) * ? * . * .
45 lines
1.1 KiB
C#
45 lines
1.1 KiB
C#
// Copyright © WireMock.Net
|
|
|
|
using NFluent;
|
|
using System.IO;
|
|
using WireMock.Util;
|
|
using Xunit;
|
|
|
|
namespace WireMock.Net.Tests.Util;
|
|
|
|
public class PathUtilsTests
|
|
{
|
|
[Theory]
|
|
[InlineData(@"subdirectory/MyXmlResponse.xml")]
|
|
[InlineData(@"subdirectory\MyXmlResponse.xml")]
|
|
public void PathUtils_CleanPath(string path)
|
|
{
|
|
// Act
|
|
var cleanPath = PathUtils.CleanPath(path);
|
|
|
|
// Assert
|
|
Check.That(cleanPath).Equals("subdirectory" + Path.DirectorySeparatorChar + "MyXmlResponse.xml");
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(null, null)]
|
|
[InlineData("", "")]
|
|
[InlineData("a", "a")]
|
|
[InlineData(@"/", "")]
|
|
[InlineData(@"//", "")]
|
|
[InlineData(@"//a", "a")]
|
|
[InlineData(@"\", "")]
|
|
[InlineData(@"\\", "")]
|
|
[InlineData(@"\\a", "a")]
|
|
public void PathUtils_CleanPath_RemoveLeadingDirectorySeparators(string path, string expected)
|
|
{
|
|
// Arrange
|
|
var cleanPath = PathUtils.CleanPath(path);
|
|
|
|
// Act
|
|
var withoutDirectorySeparators = PathUtils.RemoveLeadingDirectorySeparators(cleanPath);
|
|
|
|
// Assert
|
|
Check.That(withoutDirectorySeparators).Equals(expected);
|
|
}
|
|
} |