Exemple #1
0
        public void CorrectlyFormattedCityIspOrgResponseShouldDeserializeIntoResponseObject()
        {
            var restResponse = new RestResponse
            {
                Content     = OMNI_BODY,
                ContentType = "application/json",
                ResponseUri = new Uri("http://foo.com/omni/1.2.3.4"),
                StatusCode  = (HttpStatusCode)200
            };

            restResponse.ContentLength = restResponse.Content.Length;

            var restClient = MockRepository.GenerateStub <IRestClient>();

            restClient.Stub(r => r.Execute(Arg <IRestRequest> .Is.Anything)).Return(restResponse);

            var wsc = new WebServiceClient(0, "abcdef", new List <string> {
                "en"
            });
            var result = wsc.CityIspOrg("1.2.3.4", restClient);

            Assert.That(result, Is.Not.Null);
            Assert.That(result, Is.InstanceOf <CityIspOrgResponse>());
        }
        public void CorrectlyFormattedCityIspOrgResponseShouldDeserializeIntoResponseObject()
        {
            var restResponse = new RestResponse
            {
                Content = OMNI_BODY,
                ContentType = "application/json",
                ResponseUri = new Uri("http://foo.com/omni/1.2.3.4"),
                StatusCode = (HttpStatusCode)200
            };

            restResponse.ContentLength = restResponse.Content.Length;

            var restClient = MockRepository.GenerateStub<IRestClient>();

            restClient.Stub(r => r.Execute(Arg<IRestRequest>.Is.Anything)).Return(restResponse);

            var wsc = new WebServiceClient(0, "abcdef", new List<string> { "en" });
            var result = wsc.CityIspOrg("1.2.3.4", restClient);

            Assert.That(result, Is.Not.Null);
            Assert.That(result, Is.InstanceOf<CityIspOrgResponse>());
        }