Ejemplo 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);
        }
Ejemplo 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);
        }
Ejemplo 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);
        }
Ejemplo 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));
        }
Ejemplo 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());
        }
Ejemplo 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);
        }
Ejemplo 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);
        }
Ejemplo 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);
        }