public void HttpsReferenceResolutionNormalExamples(string expectedUrl, string expectedReferenceUrl, string host, IEnumerable <string> path, string query, string fragment) { // See 5.4.1 var referenceUri = (RelativeReference)Factories.Create(null, null, host, null, path, query, fragment); Assert.Equal(expectedReferenceUrl, referenceUri.ToString()); var result = HttpsBaseUri.Resolve(referenceUri); Assert.Equal(expectedUrl, result.ToString()); }
public void ReferenceResolutionNormalExamples_SpecifyingScheme() { // See 5.4.1, first example only var referenceUri = (GenericUniformResourceIdentifier)Factories.Create("g", null, null, null, new [] { "h" }, null, null); Assert.Equal("g:h", referenceUri.ToString()); var result = BaseUri.Resolve(referenceUri); Assert.Equal("g:h", result.ToString()); var httpsResult = HttpsBaseUri.Resolve(referenceUri); Assert.Equal("g:h", httpsResult.ToString()); }
/// <summary> /// Parses a URI reference. If the URI's scheme is not registered, then this will return an instance of <see cref="GenericUniformResourceIdentifier"/>. /// </summary> /// <param name="uriReference">The URI reference to parse.</param> public static IUniformResourceIdentifierReference Parse(string uriReference) { Parser.ParseUriReference(uriReference, out string scheme, out string userInfo, out string host, out string port, out IReadOnlyList <string> pathSegments, out string query, out string fragment); return(Factories.Create(scheme, userInfo, host, port, pathSegments, query, fragment)); }
/// <summary> /// Parses a URI reference. If the URI's scheme is not registered, then this will return an instance of <see cref="GenericUniformResourceIdentifier"/>. /// </summary> /// <param name="uriReference">The URI reference to parse.</param> public static IUniformResourceIdentifierReference Parse(string uriReference) { Parser.ParseUriReference(uriReference, out var scheme, out var userInfo, out var host, out var port, out var pathSegments, out var query, out var fragment); return(Factories.Create(scheme, userInfo, host, port, pathSegments, query, fragment)); }