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

            path.RelativeTo(parent);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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));
        }
Esempio n. 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());
        }
Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 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);
        }