public void GetUrl_sensor_not_set_should_throw_error() { var req = new DirectionRequestAccessor(); var actual = req.ToUri(); Assert.Fail("Should've encountered an InvalidOperationException due to Sensor property not being set."); }
public void GetUrl_no_Destination_set() { var req = new DirectionRequestAccessor(); //req.Origin = nothing basically; var actual = req.ToUri(); Assert.Fail("Should've encountered an InvalidOperationException due to Destination property not being set."); }
public void GetUrl_sensor_not_set_should_throw_error() { var req = new DirectionRequestAccessor(); //act //assert Assert.Throws <InvalidOperationException>(() => { var actual = req.ToUri(); }); }
public void GetUrl_no_Origin_set() { var req = new DirectionRequestAccessor(); //req.Origin = nothing basically; //act //assert Assert.Throws<InvalidOperationException>(() => { var actual = req.ToUri(); }); }
public void GetUrl_no_Destination_set() { var req = new DirectionRequestAccessor(); //req.Origin = nothing basically; //act //assert Assert.Throws <InvalidOperationException>(() => { var actual = req.ToUri(); }); }
public void GetUrl_simplest_using_address_ex1() { var req = new DirectionRequestAccessor(); req.Sensor = false; req.Origin = "New York, NY"; req.Destination = "Albany, NY"; req.Mode = TravelMode.driving; //this is default, so querystring doesn't need to contain it. Uri expected = new Uri("json?origin=New+York,+NY&destination=Albany,+NY&sensor=false", UriKind.Relative); Uri actual = req.ToUri(); Assert.AreEqual(expected, actual); }
public void GetUrl_simplest_using_latlng() { var req = new DirectionRequestAccessor(); req.Sensor = false; req.Origin = new LatLng(30.2, 40.3); req.Destination = new LatLng(50.5, 60.6); req.Mode = TravelMode.driving; //this is default, so querystring doesn't need to contain it. Uri expected = new Uri("json?origin=30.2,40.3&destination=50.5,60.6&sensor=false", UriKind.Relative); Uri actual = req.ToUri(); Assert.AreEqual(expected, actual); }
public void GetUrl_waypoints_simple_ex1() { var req = new DirectionRequestAccessor(); req.Sensor = false; req.Origin = "NY"; req.Destination = "FL"; req.Mode = TravelMode.driving; //this is default, so querystring doesn't need to contain it. req.AddWaypoint("NC"); Uri expected = new Uri("json?origin=NY&destination=FL&waypoints=NC&sensor=false", UriKind.Relative); Uri actual = req.ToUri(); Assert.AreEqual(expected, actual); }
public void GetUrl_waypoints_latlng_ex1() { var req = new DirectionRequestAccessor(); req.Sensor = false; req.Origin = "NY"; req.Destination = "Orlando,FL"; req.Mode = TravelMode.driving; //this is default, so querystring doesn't need to contain it. req.AddWaypoint(new LatLng(28.452694, -80.979195)); Uri expected = new Uri("json?origin=NY&destination=Orlando,FL&waypoints=28.452694,-80.979195&sensor=false", UriKind.Relative); Uri actual = req.ToUri(); Assert.AreEqual(expected, actual); }
public void GetUrl_simplest_using_address_ex1() { //arrange var expected = ParseQueryString("json?origin=New York, NY&destination=Albany, NY&sensor=false"); var req = new DirectionRequestAccessor(); req.Sensor = false; req.Origin = "New York, NY"; req.Destination = "Albany, NY"; req.Mode = TravelMode.driving; //this is default, so querystring doesn't need to contain it. //act var actual = ParseQueryString(req.ToUri()); //assert Assert.That(actual, Is.EquivalentTo(expected)); }
public void GetUrl_waypoints_latlng_ex1() { //arrange var expected = ParseQueryString("json?origin=NY&destination=Orlando,FL&waypoints=28.452694,-80.979195&sensor=false"); var req = new DirectionRequestAccessor(); req.Sensor = false; req.Origin = "NY"; req.Destination = "Orlando,FL"; req.Mode = TravelMode.driving; //this is default, so querystring doesn't need to contain it. req.AddWaypoint(new LatLng(28.452694, -80.979195)); //act var actual = ParseQueryString(req.ToUri()); //assert Assert.That(actual, Is.EquivalentTo(expected)); }
public void GetUrl_simplest_using_latlng() { //arrange var expected = new NameValueCollection { { "origin", "30.2,40.3" }, { "destination", "50.5,60.6" }, { "sensor", "false" } }; var req = new DirectionRequestAccessor(); req.Sensor = false; req.Origin = new LatLng(30.2, 40.3); req.Destination = new LatLng(50.5, 60.6); req.Mode = TravelMode.driving; //this is default, so querystring doesn't need to contain it. //act var actual = ParseQueryString(req.ToUri()); //assert Assert.That(actual, Is.EquivalentTo(expected)); }
public void GetUrl_waypoints_latlng_ex2() { var req = new DirectionRequestAccessor(); req.Sensor = false; req.Origin = "NY"; req.Destination = "Orlando,FL"; req.Mode = TravelMode.driving; //this is default, so querystring doesn't need to contain it. req.AddWaypoint("NJ"); req.AddWaypoint(new LatLng(28.452694, -80.979195)); req.AddWaypoint("Sarasota,FL"); Uri expected = new Uri("json?origin=NY&destination=Orlando,FL&waypoints=NJ|28.452694,-80.979195|Sarasota,FL&sensor=false", UriKind.Relative); Uri actual = req.ToUri(); Assert.AreEqual(expected, actual); }
public void GetUrl_simplest_using_latlng() { var req = new DirectionRequestAccessor(); req.Sensor = false; req.Origin = new LatLng(30.2, 40.3); req.Destination = new LatLng(50.5,60.6); req.Mode = TravelMode.driving; //this is default, so querystring doesn't need to contain it. Uri expected = new Uri("json?origin=30.2,40.3&destination=50.5,60.6&sensor=false", UriKind.Relative); Uri actual = req.ToUri(); Assert.AreEqual(expected, actual); }
public void GetUrl_waypoints_simple_ex1() { //arrange var expected = ParseQueryString("json?origin=NY&destination=FL&waypoints=NC&sensor=false"); var req = new DirectionRequestAccessor(); req.Sensor = false; req.Origin = "NY"; req.Destination = "FL"; req.Mode = TravelMode.driving; //this is default, so querystring doesn't need to contain it. req.AddWaypoint("NC"); //act var actual = ParseQueryString(req.ToUri()); //assert Assert.That(actual, Is.EquivalentTo(expected)); }
public void GetUrl_waypoints_latlng_ex2() { //arrange var expected = ParseQueryString("json?origin=NY&destination=Orlando,FL&waypoints=NJ|28.452694,-80.979195|Sarasota,FL&sensor=false"); var req = new DirectionRequestAccessor(); req.Sensor = false; req.Origin = "NY"; req.Destination = "Orlando,FL"; req.Mode = TravelMode.driving; //this is default, so querystring doesn't need to contain it. req.AddWaypoint("NJ"); req.AddWaypoint(new LatLng(28.452694, -80.979195)); req.AddWaypoint("Sarasota,FL"); //act var actual = ParseQueryString(req.ToUri()); //assert Assert.That(actual, Is.EquivalentTo(expected)); }
public void GetUrl_sensor_not_set_should_throw_error() { var req = new DirectionRequestAccessor(); //act //assert Assert.Throws<InvalidOperationException>(() => { var actual = req.ToUri(); }); }