示例#1
0
        public void NoInputTest()
        {
            var t = new FormatUrl();

            t.BuildEngine = new MockEngine(_out);

            t.Execute().ShouldBeTrue();
            t.OutputUrl.ShouldBe(string.Empty);
        }
示例#2
0
        public void WhitespaceTestOnWindows()
        {
            var t = new FormatUrl();

            t.BuildEngine = new MockEngine(_out);

            t.InputUrl = " ";
            Should.Throw <ArgumentException>(() => t.Execute());
        }
示例#3
0
        public void WhitespaceTestOnUnix()
        {
            var t = new FormatUrl();

            t.BuildEngine = new MockEngine(_out);

            t.InputUrl = " ";
            t.Execute().ShouldBeTrue();
            t.OutputUrl.ShouldBe(new Uri(Path.Combine(Environment.CurrentDirectory, t.InputUrl)).AbsoluteUri);
        }
示例#4
0
        public void UrlParentPathTest()
        {
            var t = new FormatUrl();

            t.BuildEngine = new MockEngine(_out);

            t.InputUrl = @"https://example.com/Example/../Path";
            t.Execute().ShouldBeTrue();
            t.OutputUrl.ShouldBe(@"https://example.com/Path");
        }
示例#5
0
        public void UrlLocalHostTest()
        {
            var t = new FormatUrl();

            t.BuildEngine = new MockEngine(_out);

            t.InputUrl = @"https://localhost/Example/Path";
            t.Execute().ShouldBeTrue();
            t.OutputUrl.ShouldBe(@"https://" + Environment.MachineName.ToLowerInvariant() + "/Example/Path");
        }
示例#6
0
        public void LocalWindowsAbsolutePathTest()
        {
            var t = new FormatUrl();

            t.BuildEngine = new MockEngine(_out);

            t.InputUrl = @"c:\folder\filename.ext";
            t.Execute().ShouldBeTrue();
            t.OutputUrl.ShouldBe(@"file:///c:/folder/filename.ext");
        }
示例#7
0
        public void LocalUnixAbsolutePathTest()
        {
            var t = new FormatUrl();

            t.BuildEngine = new MockEngine(_out);

            t.InputUrl = @"/usr/local/share";
            t.Execute().ShouldBeTrue();
            t.OutputUrl.ShouldBe(@"file:///usr/local/share");
        }
示例#8
0
        public void LocalRelativePathTest()
        {
            var t = new FormatUrl();

            t.BuildEngine = new MockEngine(_out);

            t.InputUrl = @".";
            t.Execute().ShouldBeTrue();
            t.OutputUrl.ShouldBe(new Uri(Environment.CurrentDirectory).AbsoluteUri);
        }
示例#9
0
        public void UncPathTest()
        {
            var t = new FormatUrl();

            t.BuildEngine = new MockEngine(_out);

            t.InputUrl = @"\\server\filename.ext";
            t.Execute().ShouldBeTrue();
            t.OutputUrl.ShouldBe(@"file://server/filename.ext");
        }