Exemplo n.º 1
0
        public async Task DeserializeResponseAsync_WrongUrl()
        {
            var client   = new HttpClient();
            var response = await client.GetAsync("https://services.odata.org/TripPinRESTierService/Robert");

            var(Result, ErrorContent) = await response.DeserializeResponseAsync <dynamic>();

            ErrorContent.Should().NotBeNullOrEmpty();
            //Result.Should().BeNull();
        }
Exemplo n.º 2
0
        public async Task DeserializeResponseAsync_SingleEntity()
        {
            var client   = new HttpClient();
            var response = await client.GetAsync("https://services.odata.org/TripPinRESTierService/People");

            var(Result, ErrorContent) = await response.DeserializeResponseAsync <ODataV4List <ExpandoObject> >();

            ErrorContent.Should().BeNullOrEmpty();
            Result.Should().NotBeNull();
        }
Exemplo n.º 3
0
        public async Task SingleEntity_DeserializesProperly()
        {
            var client   = new HttpClient();
            var response = await client.GetAsync("https://services.odata.org/TripPinRESTierService/People('russellwhyte')");

            var(Result, ErrorContent) = await response.DeserializeResponseAsync <ODataV4PrimitiveResult <ExpandoObject> >();

            ErrorContent.Should().BeNullOrEmpty();
            Result.Should().NotBeNull();
            Result.ODataContext.Should().NotBeNullOrWhiteSpace();
        }
Exemplo n.º 4
0
        public async Task ListWithCount_DeserializesProperly()
        {
            var client   = new HttpClient();
            var response = await client.GetAsync("https://services.odata.org/TripPinRESTierService/People?$count=true");

            var(Result, ErrorContent) = await response.DeserializeResponseAsync <ODataV4List <ExpandoObject> >();

            ErrorContent.Should().BeNullOrEmpty();
            Result.Should().NotBeNull();
            Result.ODataCount.Should().NotBe(0);
            Result.ODataCount.Should().Be(Result.Items.Count);
            Result.ODataContext.Should().NotBeNullOrWhiteSpace();
        }