public void TryCreate_WithValidPath_ReturnsTrue() { const string path = "C:\\tmp"; var factory = new PurePathFactory(); IPurePath tmp; var actual = factory.TryCreate(path, out tmp); Assert.IsTrue(actual); }
public void TryCreate_WithInvalidPath_ReturnsFalse() { const string path = ":\u0000::"; var factory = new PurePathFactory(); IPurePath tmp; var actual = factory.TryCreate(path, out tmp); Assert.IsFalse(actual); }
public void Compare_WindowsFormat_DifferentDrives_ChildDirectory_IsGreaterThan_ParentDirectory_ShouldBeFalse() { var parentPath = @"C:\foo\bar"; var childPath = @"D:\foo\bar\other"; var purePathFactory = new PurePathFactory(); var parentPurePath = PurePath.Create(parentPath); var childPurePath = PurePath.Create(childPath); Assert.False(childPurePath > parentPurePath); }
public void Compare_PosixFormat__DifferentRoots_ChildDirectory_IsGreaterThan_ParentDirectory_ShouldBeFalse() { var parentPath = @"/mnt/other/parent"; var childPath = @"/dev/other/parent/someChild"; var purePathFactory = new PurePathFactory(); var parentPurePath = PurePath.Create(parentPath); var childPurePath = PurePath.Create(childPath); Assert.False(childPurePath > parentPurePath); }
public void Compare_PosixFormat_ChildDirectory_IsGreaterThan_ParentDirectory_ShouldBeTrue() { var parentPath = @"/mnt/dev/parent"; var childPath = @"/mnt/dev/parent/someChild"; var purePathFactory = new PurePathFactory(); var parentPurePath = PurePath.Create(parentPath); var childPurePath = PurePath.Create(childPath); Assert.True(childPurePath > parentPurePath); }
public void Create_WithNormCaseOption_CreatesPathAndNormalizesCase() { const string part1 = "C:\\TmP"; var factory = new PurePathFactory(); var expected = (IsWindows ? (IPurePath)new PureWindowsPath(part1) : new PurePosixPath(part1)).NormCase(); var actual = factory.Create(part1); Assert.AreEqual(expected, actual); }
public void Create_FromOnePath_CreatesPath() { const string part1 = "C:\\tmp"; var factory = new PurePathFactory(); var expected = IsWindows ? (IPurePath)new PureWindowsPath(part1) : new PurePosixPath(part1); var actual = factory.Create(part1); Assert.AreEqual(expected, actual); }
public void Create_WithNormCaseOption_CreatesPathAndNormalizesCase() { const string part1 = "C:\\TmP"; var factory = new PurePathFactory(); var expected = (IsWindows ? (IPurePath) new PureWindowsPath(part1) : new PurePosixPath(part1)).NormCase(); var actual = factory.Create(part1); Assert.AreEqual(expected, actual); }
public void Create_FromOnePath_CreatesPath() { const string part1 = "C:\\tmp"; var factory = new PurePathFactory(); var expected = IsWindows ? (IPurePath) new PureWindowsPath(part1) : new PurePosixPath(part1); var actual = factory.Create(part1); Assert.AreEqual(expected, actual); }
public void Create_FromMultiplePaths_CreatesPath() { var part1 = IsWindows ? "C:\\" : "C:/"; const string part2 = "tmp"; var factory = new PurePathFactory(); var expected = IsWindows ? (IPurePath) new PureWindowsPath(part1, part2) : new PurePosixPath(part1, part2); var actual = factory.Create(part1, part2); Assert.Equal(expected, actual); }