public static void Link_ReturnsExpectedString_ForRelativeUri() { // Arrange Uri uri = new Uri("/my/relative/path", UriKind.Relative); // Act var result = UrlManip.ToProtocolRelativeString(uri); // Assert Assert.Equal("/my/relative/path", result); }
public static void Link_ReturnsExpectedString_ForAbsoluteUriAndHttpsScheme() { // Arrange Uri uri = new Uri("https://tempuri.org/my/relative/path"); // Act var result = UrlManip.ToProtocolRelativeString(uri); // Assert Assert.Equal("//tempuri.org/my/relative/path", result); }
public static void ToProtocolRelativeString_ThrowsNotSupportedException_ForUnsupportedScheme() { Uri uri = new Uri("mailto:[email protected]"); Assert.Throws <NotSupportedException>(() => UrlManip.ToProtocolRelativeString(uri)); }
public static void ToProtocolRelativeString_ThrowsArgumentNullException_ForNullInput() { Uri uri = null; Assert.Throws <ArgumentNullException>(() => UrlManip.ToProtocolRelativeString(uri)); }