コード例 #1
0
 public void ResolveUrl_ThrowsArgumentNull_PayloadUri()
 {
     var message = new ODataMessageWrapper();
     Assert.ThrowsArgumentNull(
         () => message.ResolveUrl(new Uri("http://localhost"), null),
         "payloadUri");
 }
コード例 #2
0
        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);
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        public void ResolveUrl_ThrowsArgumentNull_PayloadUri()
        {
            var message = new ODataMessageWrapper();

            Assert.ThrowsArgumentNull(
                () => message.ResolveUrl(new Uri("http://localhost"), null),
                "payloadUri");
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        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);
        }