예제 #1
0
        public void Ctor_ShouldCreateCmdLet()
        {
            var formatPath = new Format_Path();
            var cmdlet     = formatPath as Cmdlet;

            Assert.IsTrue(cmdlet != null);
        }
예제 #2
0
        public void UNCPath_ShouldReturnShortenedPath()
        {
            const string testPath       = @"\\SERVER\Hello\World";
            const string pathToValidate = @"\\S\H\World";

            var formatPath = new Format_Path {
                Path = testPath
            };
            IEnumerator result = formatPath.Invoke().GetEnumerator();

            Assert.IsTrue(result.MoveNext());
            Assert.IsTrue(result.Current is string);

            Assert.That(result.Current.ToString(), Is.EqualTo(pathToValidate));
        }
예제 #3
0
        public void HomePath_ShouldReturnShortenedPathWithTilde()
        {
            string       home           = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
            string       testPath       = Path.Combine(home, @"Hello\World");
            const string pathToValidate = @"~\H\World";

            var cmd = new Format_Path {
                Path = testPath
            };
            IEnumerator result = cmd.Invoke().GetEnumerator();

            Assert.IsTrue(result.MoveNext());
            Assert.IsTrue(result.Current is string);

            Assert.That(result.Current.ToString(), Is.EqualTo(pathToValidate));
        }