public void GetQueryStringParametersWhenCoordinateTest() { var request = new PlusCodeGeocodeRequest { Key = "abc", Address = new Entities.Maps.Geocoding.PlusCode.Request.Location(new Coordinate(1, 1)) }; var queryStringParameters = request.GetQueryStringParameters(); Assert.IsNotNull(queryStringParameters); var key = queryStringParameters.SingleOrDefault(x => x.Key == "key"); var keyExpected = request.Key; Assert.IsNotNull(key); Assert.AreEqual(keyExpected, key.Value); var language = queryStringParameters.SingleOrDefault(x => x.Key == "language"); var languageExpected = request.Language.ToCode(); Assert.IsNotNull(language); Assert.AreEqual(languageExpected, language.Value); var address = queryStringParameters.SingleOrDefault(x => x.Key == "address"); var addressExpected = request.Address.ToString(); Assert.IsNotNull(address); Assert.AreEqual(addressExpected, address.Value); }
public void GetQueryStringParametersWhenKeyIsNullTest() { var request = new PlusCodeGeocodeRequest { Address = new Entities.Maps.Geocoding.PlusCode.Request.Location(new Coordinate(1, 1)) }; Assert.DoesNotThrow(() => request.GetQueryStringParameters()); }
public void GetQueryStringParametersTest() { var request = new PlusCodeGeocodeRequest { Key = "abc", PlaceId = "abc" }; Assert.DoesNotThrow(() => request.GetQueryStringParameters()); }
public void GetQueryStringParametersWhenAddressIsNullTest() { var request = new PlusCodeGeocodeRequest { Key = "key" }; var exception = Assert.Throws <ArgumentException>(() => { var parameters = request.GetQueryStringParameters(); Assert.IsNull(parameters); }); Assert.IsNotNull(exception); Assert.AreEqual(exception.Message, "Address is required"); }
public void GetQueryStringParametersWhenPlaceIdAndLocationAndAddressAndGlobalCodeIsNullTest() { var request = new PlusCodeGeocodeRequest { Key = "abc" }; var exception = Assert.Throws <ArgumentException>(() => { var parameters = request.GetQueryStringParameters(); Assert.IsNull(parameters); }); Assert.IsNotNull(exception); Assert.AreEqual(exception.Message, "PlaceId, Location, Address or GlobalCode is required"); }
public void GetQueryStringParametersWhenLocalCodeAndLocalityTest() { var request = new PlusCodeGeocodeRequest { Key = "abc", Address = new Entities.Maps.Geocoding.PlusCode.Request.Location(new LocalCodeAndLocality("local_code", "locality")) }; var queryStringParameters = request.GetQueryStringParameters(); Assert.IsNotNull(queryStringParameters); var address = queryStringParameters.SingleOrDefault(x => x.Key == "address"); var addressExpected = request.Address.ToString(); Assert.IsNotNull(address); Assert.AreEqual(addressExpected, address.Value); }
public void GetQueryStringParametersWhenEmailTest() { var request = new PlusCodeGeocodeRequest { Key = "abc", Address = new Entities.Maps.Geocoding.PlusCode.Request.Location(new Coordinate(1, 1)), Email = "email" }; var queryStringParameters = request.GetQueryStringParameters(); Assert.IsNotNull(queryStringParameters); var email = queryStringParameters.SingleOrDefault(x => x.Key == "email"); var emailExpected = request.Email; Assert.IsNotNull(email); Assert.AreEqual(emailExpected, email.Value); }
public void GetQueryStringParametersWhenUseEncryptedKeyTest() { var request = new PlusCodeGeocodeRequest { Key = "abc", Address = new Entities.Maps.Geocoding.PlusCode.Request.Location(new Coordinate(1, 1)), UseEncryptedKey = true }; var queryStringParameters = request.GetQueryStringParameters(); Assert.IsNotNull(queryStringParameters); var key = queryStringParameters.SingleOrDefault(x => x.Key == "ekey"); var keyExpected = request.Key; Assert.IsNotNull(key); Assert.AreEqual(keyExpected, key.Value); }