Пример #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");
        }