示例#1
0
        public void RelativeTo_WithParentLackingDrive_ThrowsException()
        {
            var parent = new MockPath(@"\users\");
            var path   = new MockPath(@"c:\users\nemec\file.txt");

            path.RelativeTo(parent);
        }
示例#2
0
        public void RelativeTo_WithParentInDifferentDir_ThrowsException()
        {
            var parent = new MockPath(@"\Program Files\");
            var path   = new MockPath(@"c:\users\nemec\file.txt");

            path.RelativeTo(parent);
        }
示例#3
0
        public void RelativeTo_WithParentContainingPartialFilename_ThrowsException()
        {
            var parent = new MockPath(@"c:\users\nemec\file");
            var path   = new MockPath(@"c:\users\nemec\file.txt");

            path.RelativeTo(parent);
        }
示例#4
0
        public void RelativeTo_WithParentLackingDrive_ThrowsException()
        {
            var parent = new MockPath(@"\users\");
            var path   = new MockPath(@"c:\users\nemec\file.txt");

            Assert.Throws <ArgumentException>(() => path.RelativeTo(parent));
        }
示例#5
0
        public void RelativeTo_WithParent_IsAbsoluteIsFalse()
        {
            var parent = new MockPath(@"c:\users\");
            var path   = new MockPath(@"c:\users\nemec\file.txt");

            path.RelativeTo(parent);

            Assert.IsTrue(path.IsAbsolute());
        }
示例#6
0
        public void RelativeTo_WithLongUncPath_ReturnsRelativePath()
        {
            var expected = new MockPath(@"subdir\file.exe");

            var parent = new MockPath(@"\\some\share\");
            var path   = new MockPath(@"\\some\share\subdir\file.exe");

            var actual = path.RelativeTo(parent);

            Assert.AreEqual(expected, actual);
        }
示例#7
0
        public void RelativeTo_WithLongPath_ReturnsRelativePath()
        {
            var expected = new MockPath(@"nemec\tmp\filestorage\file.txt");

            var parent = new MockPath(@"c:\users\");
            var path   = new MockPath(@"c:\users\nemec\tmp\filestorage\file.txt");

            var actual = path.RelativeTo(parent);

            Assert.AreEqual(expected, actual);
        }
示例#8
0
        public void RelativeTo_WithParent_ReturnsRelativePath()
        {
            var expected = new MockPath(@"nemec\file.txt");

            var parent = new MockPath(@"c:\users\");
            var path   = new MockPath(@"c:\users\nemec\file.txt");

            var actual = path.RelativeTo(parent);

            Assert.Equal(expected, actual);
        }