[Test] public void ExtractInfoFromRootObj() { // ARANGE MapQuestApiProcessor mapQuestApiProcessor = new MapQuestApiProcessor(); Root testObj = new Root(); Route testRouteObj = new Route(); BoundingBox testBoundingBoxObj = new BoundingBox(); Ul testUlObj = new Ul(); Lr testLrObj = new Lr(); testObj.route = testRouteObj; testObj.route.boundingBox = testBoundingBoxObj; testObj.route.boundingBox.ul = testUlObj; testObj.route.boundingBox.lr = testLrObj; testObj.route.sessionId = "testSessionId"; testObj.route.boundingBox.ul.lat = 123; testObj.route.boundingBox.ul.lng = 123; testObj.route.boundingBox.lr.lat = 123; testObj.route.boundingBox.lr.lng = 123; string testBoundingBox = "123,123,123,123"; Tuple <string, string> actualTuple = new Tuple <string, string>(testObj.route.sessionId, testBoundingBox); // ACT Tuple <string, string> t = mapQuestApiProcessor.ExtractInfoFromRootObj(testObj); // ASSERT Assert.AreEqual(t, actualTuple); }
public void CreateImageFilePath_Wrong_Test() { // ARANGE MapQuestApiProcessor mapQuestApiProcessor = new MapQuestApiProcessor(); string actualPath = "\\testName.png"; // ACT string testPath = mapQuestApiProcessor.CreateImageFilePath("test"); // ASSERT Assert.AreNotEqual(testPath, actualPath); }
public void CreateDirectionApiUrl_Test() { // ARANGE MapQuestApiProcessor mapQuestApiProcessor = new MapQuestApiProcessor(); string actualUrl = "http://www.mapquestapi.com/directions/v2/route?key=&from=fromTest&to=toTest"; // ACT string testUrl = mapQuestApiProcessor.CreateDirectionApiUrl("fromTest", "toTest", "tourNameTest"); // ASSERT Assert.AreEqual(actualUrl, testUrl); }
public async void SaveRouteImageFromApi(string from, string to, string tourName) { Log.Info("SaveRouteImageFromApi method of our BL factory class is called"); MapQuestApiProcessor mapQuestApiProcessor = new MapQuestApiProcessor(); string directionsApiurl = mapQuestApiProcessor.CreateDirectionApiUrl(from, to, tourName); //calling the Directions Api: Tuple <string, string> t = await mapQuestApiProcessor.DirectionsAPI(directionsApiurl, tourName); string staticMapApiUrl = mapQuestApiProcessor.CreateStaticMapApiUrl(t.Item1, t.Item2); //calling the StaticMap Api and saving the image: mapQuestApiProcessor.StaticMapAPI(staticMapApiUrl, tourName); }
public void CreateStaticMapApiUrl_Test() { // ARANGE MapQuestApiProcessor mapQuestApiProcessor = new MapQuestApiProcessor(); string testSessionId = "abc123"; string testBoundingBox = "123456"; string actualUrl = "https://www.mapquestapi.com/staticmap/v5/map?key=&size=640,480&zoom=11&session=abc123&boundingBox=123456"; // ACT string testUrl = mapQuestApiProcessor.CreateStaticMapApiUrl(testSessionId, testBoundingBox); // ASSERT Assert.AreEqual(actualUrl, testUrl); }