Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
        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);
        }
Example #4
0
        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);
        }
Example #5
0
        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);
        }
Example #6
0
        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);
        }
Example #7
0
        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);
        }
Example #8
0
        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);
        }
Example #9
0
        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);
        }
Example #10
0
        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);
        }
Example #11
0
        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);
        }
Example #12
0
        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);
        }