public void When_FromStringToPath(string input) { PathRef castedPathRef = input; PathRef constructedPathRef = new PathRef(input); Assert.That(castedPathRef.ToString(), Is.EqualTo(constructedPathRef.ToString())); }
public void When_FromPathToString(string input) { PathRef pathRef = new PathRef(input); string casted = pathRef; Assert.That(casted, Is.EqualTo(pathRef.ToString())); }
public void NormalizingRooted() { PathRef pathRef = new PathRef(@"C:\DirA\DirB"); Assert.That(pathRef.WindowsPath, Is.EqualTo(@"C:\DirA\DirB")); Assert.That(pathRef.PosixPath, Is.EqualTo(@"C:/DirA/DirB")); }
public void NavigationJoin() { PathRef pathRef = new PathRef("DirA/DirB"); pathRef.JoinWith("DirE/../DirF"); //Relative paths are also allowed Assert.That(pathRef.PosixPath, Is.EqualTo(@"DirA/DirB/DirF")); }
public void When_UsingPointToParent(string input, string expectedOutput) { PathRef pathRef = new PathRef(input); Assert.That(() => { pathRef.PointToParent(); }, Throws.Nothing); Assert.That(pathRef.ToString(), Is.EqualTo(expectedOutput)); }
public void AbsoluteToRelativePaths() { PathRef pathRef = new PathRef("DirA/DirB"); pathRef.JoinWith("../../../DirC"); Assert.That(pathRef.PosixPath, Is.EqualTo(@"../DirC")); }
public void When_EmptyJoiningWithNull() { PathRef pathRef = new PathRef(); Assert.That(() => { pathRef.JoinWith(null); }, Throws.Nothing); Assert.That(pathRef.ToString(), Is.EqualTo("")); }
public void When_EmptyJoiningWithRelativePath(string[] toJoin, string expectedOutput) { PathRef pathRef = new PathRef(); Assert.That(() => { pathRef.JoinWith(toJoin); }, Throws.Nothing); Assert.That(pathRef.ToString(), Is.EqualTo(expectedOutput)); }
public void When_ComparingToEmptyPathRef(string inputA) { PathRef pathRefA = new PathRef(inputA); PathRef emptyPathRef = new PathRef(); Assert.That(pathRefA.Equals(emptyPathRef), Is.False); }
public void Normalizing() { PathRef pathRef = new PathRef("../DirA/DirB"); Assert.That(pathRef.WindowsPath, Is.EqualTo(@"..\DirA\DirB")); Assert.That(pathRef.PosixPath, Is.EqualTo(@"../DirA/DirB")); }
public void When_ComparingEmptyPathRefs() { PathRef pathRefA = new PathRef(); PathRef pathRefB = new PathRef(); Assert.That(pathRefA.Equals(pathRefB), Is.True); }
public void When_UsingPointToChildWithValidArguments(string input, string childName, string expectedOutput) { PathRef pathRef = new PathRef(input); Assert.That(() => { pathRef.PointToChild(childName); }, Throws.Nothing); Assert.That(pathRef.ToString(), Is.EqualTo(expectedOutput)); }
public void When_CreatingWithNull() { PathRef pathRef = new PathRef(null); Assert.That(pathRef.IsNull, Is.True); Assert.That(pathRef.ToString(), Is.Null); }
public void Clearing() { PathRef pathRef = new PathRef("DirA/DirB"); pathRef.Clear(); Assert.That(pathRef.PosixPath, Is.EqualTo("")); }
public void When_ComparingToInequalPathRef(string inputA, string inputB) { PathRef pathRefA = new PathRef(inputA); PathRef pathRefB = new PathRef(inputB); Assert.That(pathRefA.Equals(pathRefB), Is.False); }
public void WhenBreakoutRelativePath(string input, char directorySeparator, string expected) { PathRef pathRef = new PathRef(input); string normalized = pathRef.NormalizePath(directorySeparator); Assert.That(normalized, Is.EqualTo(expected)); }
public void When_JoiningWithNullArray(string original) { PathRef pathRef = new PathRef(original); string expectedOutput = pathRef.ToString(); Assert.That(() => { pathRef.JoinWith(new string[] { null, null, null }); }, Throws.Nothing); Assert.That(pathRef.ToString(), Is.EqualTo(expectedOutput)); }
public void RelativePaths() { PathRef pathRef = new PathRef("../DirB"); Assert.That(pathRef.IsRelative, Is.True); Assert.That(pathRef.IsAbsolute, Is.False); Assert.That(pathRef.PosixPath, Is.EqualTo(@"../DirB")); }
public void When_CreatingEmpty() { PathRef pathRef = new PathRef(); Assert.That(pathRef.IsNull, Is.False); Assert.That(pathRef.IsEmpty, Is.True); Assert.That(pathRef.ToString(), Is.EqualTo("")); }
public void When_RootedPathIsGiven(string str) { PathRef pathRef = new PathRef(str); Assert.That(pathRef.IsAbsolute, Is.True); Assert.That(pathRef.IsRelative, Is.False); Assert.That(pathRef.IsRooted, Is.True); }
public void When_JoiningRootedWithRootedPath(string original, string[] toJoin, string expectedOutput) { PathRef pathRef = new PathRef(original); Assert.That(() => { pathRef.JoinWith(toJoin); }, Throws.Nothing); Assert.That(pathRef.IsRooted, Is.True); Assert.That(pathRef.ToString(), Is.EqualTo(expectedOutput)); }
public void When_UsingClearOnEmptyPath() { PathRef pathRef = new PathRef(); Assert.That(() => { pathRef.Clear(); }, Throws.Nothing); Assert.That(pathRef.IsEmpty, Is.True); Assert.That(pathRef.ToString(), Is.EqualTo("")); }
public void When_IsNull() { PathRef pathRef = new PathRef(null); Assert.That(pathRef.IsAbsolute, Is.False); Assert.That(pathRef.IsRelative, Is.False); Assert.That(pathRef.IsRooted, Is.False); }
public void When_Combine5(string path1, string path2, string path3, string path4, string path5) { //Take note PathRef.Combine does never initialize the PathRef empty, so we should not expect it to either var expectedPathRef = new PathRef(path1); expectedPathRef.JoinWith(path2, path3, path4, path5); Assert.That(PathRef.Combine(path1, path2, path3, path4, path5), Is.EqualTo(expectedPathRef)); }
public void When_UsingClearOnAbsolutePath(string input) { PathRef pathRef = new PathRef(input); Assert.That(() => { pathRef.Clear(); }, Throws.Nothing); Assert.That(pathRef.IsAbsolute, Is.True); Assert.That(pathRef.IsEmpty, Is.False); Assert.That(pathRef.ToString(), Is.EqualTo(@"\")); }
public void Navigation() { PathRef pathRef = new PathRef("DirA/DirB"); pathRef.PointToParent(); Assert.That(pathRef.PosixPath, Is.EqualTo(@"DirA")); pathRef.PointToChild("DirC"); Assert.That(pathRef.PosixPath, Is.EqualTo(@"DirA/DirC")); }
public void When_UsingClearOnRelativePath(string input) { PathRef pathRef = new PathRef(input); Assert.That(() => { pathRef.Clear(); }, Throws.Nothing); Assert.That(pathRef.IsRelative, Is.True); Assert.That(pathRef.IsEmpty, Is.True); Assert.That(pathRef.ToString(), Is.EqualTo("")); }
public void When_UsingClearOnNullPath() { PathRef pathRef = new PathRef(null); Assert.That(() => { pathRef.Clear(); }, Throws.Nothing); Assert.That(pathRef.IsNull, Is.True); Assert.That(pathRef.IsEmpty, Is.False); Assert.That(pathRef.ToString(), Is.Null); }
public void Rooting() { PathRef pathRef = new PathRef("C:/DirA"); Assert.That(pathRef.IsRooted, Is.True); pathRef.JoinWith("../../../.."); Assert.That(pathRef.PosixPath, Is.EqualTo(@"C:")); pathRef.Clear(); Assert.That(pathRef.IsRooted, Is.False); }
public void When_CreatingWithValidInput(string input, string expectedOutput) { PathRef pathRef = new PathRef(input); Assert.That(pathRef.ToString(), Is.EqualTo(expectedOutput)); }