public void ResolveUrl_ThrowsArgumentNull_PayloadUri() { var message = new ODataMessageWrapper(); Assert.ThrowsArgumentNull( () => message.ResolveUrl(new Uri("http://localhost"), null), "payloadUri"); }
public void ResolveUrl_ReturnsNull_IfNoContentIdInUri() { var message = new ODataMessageWrapper(); Uri uri = message.ResolveUrl(new Uri("http://localhost"), new Uri("/values", UriKind.Relative)); Assert.Null(uri); }
public void ResolveUrl_ReturnsOriginalUri_IfContentIdCannotBeResolved() { StringContent content = new StringContent(String.Empty); var message = new ODataMessageWrapper(new MemoryStream(), content.Headers); Uri uri = message.ResolveUrl(new Uri("http://localhost"), new Uri("$1", UriKind.Relative)); Assert.Equal("$1", uri.OriginalString); }
public void ResolveUrl_ResolvesUriWithContentId() { StringContent content = new StringContent(String.Empty); Dictionary<string, string> contentIdMapping = new Dictionary<string, string> { {"1", "http://localhost/values(1)"}, {"11", "http://localhost/values(11)"}, }; var message = new ODataMessageWrapper(new MemoryStream(), content.Headers, contentIdMapping); Uri uri = message.ResolveUrl(new Uri("http://localhost"), new Uri("$1", UriKind.Relative)); Assert.Equal("http://localhost/values(1)", uri.OriginalString); }
public void ResolveUrl_ResolvesUriWithContentId() { StringContent content = new StringContent(String.Empty); Dictionary <string, string> contentIdMapping = new Dictionary <string, string> { { "1", "http://localhost/values(1)" }, { "11", "http://localhost/values(11)" }, }; var message = new ODataMessageWrapper(new MemoryStream(), content.Headers, contentIdMapping); Uri uri = message.ResolveUrl(new Uri("http://localhost"), new Uri("$1", UriKind.Relative)); Assert.Equal("http://localhost/values(1)", uri.OriginalString); }