public void IsHttp_DetectsHttpUris(string input, bool expected) { // Arrange Uri address = new Uri(input, UriKind.RelativeOrAbsolute); // Act bool actual = address.IsHttp(); // Assert Assert.Equal(expected, actual); }
public void IsHttp_HandlesNull() { // Arrange Uri address = null; // Act bool actual = address.IsHttp(); // Assert Assert.False(actual); }
public void IsHttp_DetectsHttpUris(string input, bool expected) { // Arrange Uri address = new Uri(input, UriKind.RelativeOrAbsolute); // Act bool actual = address.IsHttp(); // Assert Assert.Equal(expected, actual); }
private void InitializeValues(string method, Uri requestUri) { if (method.IsNullOrEmpty()) { throw new ArgumentNullException("method"); } if (requestUri != null && requestUri.IsAbsoluteUri && !requestUri.IsHttp()) { throw new ArgumentException("SR.net_http_client_http_baseaddress_required", "requestUri"); } this.Headers = new HttpRequestHeaders(); this.Method = method; this.RequestUri = requestUri; this.Version = new Version(1, 1); }
/// <summary> /// Verifies that the <paramref name="webHookUri"/> has either an 'http' or 'https' scheme. /// </summary> /// <param name="webHookUri">The URI to verify.</param> protected virtual void VerifyUri(Uri webHookUri) { // Check that WebHook URI scheme is either '<c>http</c>' or '<c>https</c>'. if (!(webHookUri.IsHttp() || webHookUri.IsHttps())) { string msg = string.Format(CultureInfo.CurrentCulture, CustomResources.Manager_NoHttpUri, webHookUri); _logger.Error(msg); throw new InvalidOperationException(msg); } }