Esempio n. 1
0
        public void NoInputTest()
        {
            var t = new FormatUrl();

            t.BuildEngine = new MockEngine(_out);

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

            t.BuildEngine = new MockEngine(_out);

            t.InputUrl = " ";
            Should.Throw <ArgumentException>(() => t.Execute());
        }
Esempio n. 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);
        }
Esempio n. 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");
        }
Esempio n. 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");
        }
Esempio n. 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");
        }
Esempio n. 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");
        }
Esempio n. 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);
        }
Esempio n. 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");
        }