コード例 #1
0
        public void CouldAppendPath()
        {
            var p        = new DataPathStruct("a/b/c");
            var p2       = new DataPathStruct("d/e/f/g");
            var appended = p.Append(p2);

            Assert.AreEqual(p.Level + p2.Level + 1, appended.Level);
            Assert.AreEqual(6, appended.Level);
            Assert.AreEqual("a/b/c/d/e/f/g", appended.ToString());
        }
コード例 #2
0
        public void CouldCreateExternalRepoPath()
        {
            var str = "@a/b/c/";
            var p   = new DataPathStruct(str);

            Assert.AreEqual(3, p.Level);
            Assert.AreEqual(7, p.Length);
            Assert.AreEqual(str, p.ToString());
            Assert.IsTrue(p.IsRepo);
            Assert.IsTrue(p.IsExternal);
        }
コード例 #3
0
        public void CouldCreatePath()
        {
            var str = "a/b/c";
            var p   = new DataPathStruct(str);

            Assert.AreEqual(2, p.Level);
            Assert.AreEqual(5, p.Length);
            Assert.AreEqual(str, p.ToString());
            Assert.IsFalse(p.IsRepo);
            Assert.IsFalse(p.IsExternal);
        }
コード例 #4
0
        public void CouldGetParent()
        {
            var p      = new DataPathStruct("a/b/c");
            var parent = p.Parent();

            Assert.AreEqual("a/b/", parent.ToString());
            Assert.AreEqual(2, parent.Level);

            parent = parent.Parent();
            Assert.AreEqual("a/", parent.ToString());
            Assert.AreEqual(1, parent.Level);

            parent = parent.Parent();
            Assert.AreEqual("", parent.ToString());
            Assert.AreEqual(0, parent.Level);

            parent = new DataPathStruct("a").Parent();
            Assert.AreEqual("", parent.ToString());
            Assert.AreEqual(0, parent.Level);
        }