private void LoadClient() { _restClient = new RestClient(DropNet.Resource.SecureLoginBaseUrl); _restClient.ClearHandlers(); _restClient.AddHandler("*", new JsonDeserializer()); //probly not needed... RequestCount = 0; DataCount = 0; _requestHelper = new RequestHelper(_version); }
//[TestMethod] public void Getting_location_by_latitude_and_longitude_will_return_correct_information() { var helper = new DropNet.Helpers.RequestHelper(string.Empty); var latitude = 6.4545366666666668; var longitude = 80.896691666666669; var request = helper.CreateGeoLocationRequest(longitude, latitude); var restClient = GetClient("http://maps.googleapis.com"); var response = restClient.Execute <GoogleGeoCodeResponse>(request); if (response.StatusCode == HttpStatusCode.OK) { Assert.IsTrue(response.Data.results.Count() == 4, "Es wurde nicht die richtige Anzahl an Ergebnissen zurückgegben"); var componenents = response.Data.results[0].address_components; var location = new Location { Country = componenents.Where(x => x.types.Contains("country")) .DefaultIfEmpty(new address_component()) .First() .long_name, State = componenents.Where(x => x.types.Contains("administrative_area_level_1")) .DefaultIfEmpty(new address_component()) .First() .long_name, County = componenents.Where(x => x.types.Contains("administrative_area_level_2")) .DefaultIfEmpty(new address_component()) .First() .long_name, City = componenents.Where(x => x.types.Contains("locality")) .DefaultIfEmpty(new address_component()) .First() .long_name }; location.Name = string.Join(",", new[] { location.City, location.County, location.State, location.Country } .Where(x => !string.IsNullOrEmpty(x))); Assert.IsTrue(location.Country == "Sri Lanka", "Der Ort wurde nicht richtig erkannt"); } else { Assert.Fail("Status hatte nicht den richtigen Wert"); } }
public void RequestHelperConstructorTest() { string version = "0"; RequestHelper _target = new RequestHelper(version); Assert.IsNotNull(_target); }
public RequestHelperTest() { _version = "0"; _target = new RequestHelper(_version); fixture = new Fixture(); }