Esempio n. 1
0
        public void CheckThatTheClientThowsAnExceptionWhenNoRootPathIsSupplied()
        {
            var key     = Guid.NewGuid().ToString();
            var request = new GoogleForwardGeocodingRequest(key)
            {
                Query    = "BS5 6DR",
                RootPath = string.Empty
            };

            var exception = Assert.Throws <AggregateException>(() => { var bob = new ApiClient().GetAsync(request).Result; });

            Assert.That(exception.InnerExceptions.Count, Is.EqualTo(1));
            Assert.That(exception.InnerExceptions.First().GetType(), Is.EqualTo(typeof(NullReferenceException)));
        }
Esempio n. 2
0
        public async void CheckThatTheApiClientCorrectlySerialisesAGoogleForwardGeoCodingResponse()
        {
            var key     = Guid.NewGuid().ToString();
            var request = new GoogleForwardGeocodingRequest(key)
            {
                Query = "BS5 6DR"
            };

            var apiResponse = await GetResponse(new ApiClient(), request, GetForwardGeocodingGoogleResult());

            Assert.That(request.Path, Is.StringContaining($"key={key}"));
            Assert.That(apiResponse, Is.Not.Null);
            Assert.That(apiResponse.Results.Length, Is.EqualTo(1));
            Assert.That(apiResponse.Results[0].PlaceId, Is.EqualTo("ChIJLySUNTiOcUgRKFx4O3Om9Vs"));
        }