public void AppendPathTest()
        {
            Assert.IsTrue(Directories.All(p => p.AppendPath(root) == p));
            Assert.IsTrue(Directories.All(p => p.AppendPath("") == p));

            var subpath    = FileSystemPath.Parse("/dir/file");
            var subpathstr = "dir/file";

            foreach (var p in Directories)
            {
                Assert.IsTrue(p.AppendPath(subpath).ParentPath.ParentPath == p);
            }
            foreach (var p in Directories)
            {
                Assert.IsTrue(p.AppendPath(subpathstr).ParentPath.ParentPath == p);
            }
            foreach (var pa in Directories)
            {
                foreach (var pb in _paths.Where(pb => !pb.IsRoot))
                {
                    Assert.IsTrue(pa.AppendPath(pb).IsChildOf(pa));
                }
            }
            EAssert.Throws <InvalidOperationException>(() => fileA.AppendPath(subpath));
            EAssert.Throws <InvalidOperationException>(() => fileA.AppendPath(subpathstr));
            EAssert.Throws <ArgumentException>(() => directoryA.AppendPath("/rootedpath/"));
        }
示例#2
0
        public void AppendPathTest()
        {
            Assert.True(Directories.All(p => p.AppendPath(_root) == p));
            Assert.True(Directories.All(p => p.AppendPath("") == p));

            var subpath    = FileSystemPath.Parse("/dir/file");
            var subpathstr = "dir/file";

            foreach (var p in Directories)
            {
                Assert.True(p.AppendPath(subpath).ParentPath.ParentPath == p);
            }
            foreach (var p in Directories)
            {
                Assert.True(p.AppendPath(subpathstr).ParentPath.ParentPath == p);
            }
            foreach (var pa in Directories)
            {
                foreach (var pb in _paths.Where(pb => !pb.IsRoot))
                {
                    Assert.True(pa.AppendPath(pb).IsChildOf(pa));
                }
            }
            // ReSharper disable ReturnValueOfPureMethodIsNotUsed
            EAssert.Throws <InvalidOperationException>(() => _fileA.AppendPath(subpath));
            EAssert.Throws <InvalidOperationException>(() => _fileA.AppendPath(subpathstr));
            EAssert.Throws <ArgumentException>(() => DirectoryA.AppendPath("/rootedpath/"));
            // ReSharper restore ReturnValueOfPureMethodIsNotUsed
        }
示例#3
0
        public void AppendPathTest()
        {
            Directories.All(p => p.AppendPath(root) == p);
            Directories.All(p => p.AppendPath("") == p);

            var subpath    = FileSystemPath.Parse("/dir/file");
            var subpathstr = "dir/file";

            Directories.All(p => p.AppendPath(subpath).ParentPath.ParentPath == p);
            Directories.All(p => p.AppendPath(subpathstr).ParentPath.ParentPath == p);
            Directories.All(pa => _paths.All(pb => pa.AppendPath(pb).IsChildOf(pa)));
            EAssert.Throws <InvalidOperationException>(() => fileA.AppendPath(subpath));
            EAssert.Throws <InvalidOperationException>(() => fileA.AppendPath(subpathstr));
            EAssert.Throws <ArgumentException>(() => directoryA.AppendPath("/rootedpath/"));
        }