public void NoInputTest() { var t = new FormatUrl(); t.BuildEngine = new MockEngine(_out); t.Execute().ShouldBeTrue(); t.OutputUrl.ShouldBe(string.Empty); }
public void WhitespaceTestOnWindows() { var t = new FormatUrl(); t.BuildEngine = new MockEngine(_out); t.InputUrl = " "; Should.Throw <ArgumentException>(() => t.Execute()); }
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); }
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"); }
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"); }
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"); }
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"); }
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); }
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"); }