예제 #1
0
            public void When_UsingPointToChildWithInvalidArguments(string input, string childName)
            {
                PathRef pathRef        = new PathRef(input);
                string  expectedOutput = pathRef.ToString();

                Assert.That(() => { pathRef.PointToChild(childName); }, Throws.ArgumentException);
                Assert.That(pathRef.ToString(), Is.EqualTo(expectedOutput));
            }
예제 #2
0
            public void When_JoiningWithNullArray(string original)
            {
                PathRef pathRef        = new PathRef(original);
                string  expectedOutput = pathRef.ToString();

                Assert.That(() => { pathRef.JoinWith(new string[] { null, null, null }); }, Throws.Nothing);
                Assert.That(pathRef.ToString(), Is.EqualTo(expectedOutput));
            }
예제 #3
0
            public void When_UsingPointToParent(string input, string expectedOutput)
            {
                PathRef pathRef = new PathRef(input);

                Assert.That(() => { pathRef.PointToParent(); }, Throws.Nothing);
                Assert.That(pathRef.ToString(), Is.EqualTo(expectedOutput));
            }
예제 #4
0
            public void When_EmptyJoiningWithNull()
            {
                PathRef pathRef = new PathRef();

                Assert.That(() => { pathRef.JoinWith(null); }, Throws.Nothing);
                Assert.That(pathRef.ToString(), Is.EqualTo(""));
            }
예제 #5
0
        public void When_CreatingWithNull()
        {
            PathRef pathRef = new PathRef(null);

            Assert.That(pathRef.IsNull, Is.True);
            Assert.That(pathRef.ToString(), Is.Null);
        }
예제 #6
0
            public void When_EmptyJoiningWithRelativePath(string[] toJoin, string expectedOutput)
            {
                PathRef pathRef = new PathRef();

                Assert.That(() => { pathRef.JoinWith(toJoin); }, Throws.Nothing);
                Assert.That(pathRef.ToString(), Is.EqualTo(expectedOutput));
            }
예제 #7
0
            public void When_FromPathToString(string input)
            {
                PathRef pathRef = new PathRef(input);
                string  casted  = pathRef;

                Assert.That(casted, Is.EqualTo(pathRef.ToString()));
            }
예제 #8
0
            public void When_FromStringToPath(string input)
            {
                PathRef castedPathRef      = input;
                PathRef constructedPathRef = new PathRef(input);

                Assert.That(castedPathRef.ToString(), Is.EqualTo(constructedPathRef.ToString()));
            }
예제 #9
0
            public void When_JoiningRootedWithRootedPath(string original, string[] toJoin, string expectedOutput)
            {
                PathRef pathRef = new PathRef(original);

                Assert.That(() => { pathRef.JoinWith(toJoin); }, Throws.Nothing);
                Assert.That(pathRef.IsRooted, Is.True);
                Assert.That(pathRef.ToString(), Is.EqualTo(expectedOutput));
            }
예제 #10
0
            public void When_UsingClearOnEmptyPath()
            {
                PathRef pathRef = new PathRef();

                Assert.That(() => { pathRef.Clear(); }, Throws.Nothing);
                Assert.That(pathRef.IsEmpty, Is.True);
                Assert.That(pathRef.ToString(), Is.EqualTo(""));
            }
예제 #11
0
        public void When_CreatingEmpty()
        {
            PathRef pathRef = new PathRef();

            Assert.That(pathRef.IsNull, Is.False);
            Assert.That(pathRef.IsEmpty, Is.True);
            Assert.That(pathRef.ToString(), Is.EqualTo(""));
        }
예제 #12
0
            public void When_UsingClearOnAbsolutePath(string input)
            {
                PathRef pathRef = new PathRef(input);

                Assert.That(() => { pathRef.Clear(); }, Throws.Nothing);
                Assert.That(pathRef.IsAbsolute, Is.True);
                Assert.That(pathRef.IsEmpty, Is.False);
                Assert.That(pathRef.ToString(), Is.EqualTo(@"\"));
            }
예제 #13
0
            public void When_UsingClearOnNullPath()
            {
                PathRef pathRef = new PathRef(null);

                Assert.That(() => { pathRef.Clear(); }, Throws.Nothing);
                Assert.That(pathRef.IsNull, Is.True);
                Assert.That(pathRef.IsEmpty, Is.False);
                Assert.That(pathRef.ToString(), Is.Null);
            }
예제 #14
0
            public void When_UsingClearOnRelativePath(string input)
            {
                PathRef pathRef = new PathRef(input);

                Assert.That(() => { pathRef.Clear(); }, Throws.Nothing);
                Assert.That(pathRef.IsRelative, Is.True);
                Assert.That(pathRef.IsEmpty, Is.True);
                Assert.That(pathRef.ToString(), Is.EqualTo(""));
            }
예제 #15
0
        public void When_CreatingWithValidInput(string input, string expectedOutput)
        {
            PathRef pathRef = new PathRef(input);

            Assert.That(pathRef.ToString(), Is.EqualTo(expectedOutput));
        }
예제 #16
0
            public void When_UsingToString(string input)
            {
                PathRef pathRef = new PathRef(input);

                Assert.That(pathRef.ToString(), Is.EqualTo(pathRef.NormalizePath()));
            }