public void DoRequestWithEmptyUrlReturnsCorrectResponse() { //Arrange FakeSendRequest fakeSendRequest = new FakeSendRequest(); string expectedResponse = "no response"; //Act string actualResponse = fakeSendRequest.DoRequest(); //Assert Assert.AreEqual(actualResponse, expectedResponse); }
public void ConstructorWithNoValuesReturnsCorrectUrl() { //Arrange ISendRequest fakeSendRequest = new FakeSendRequest(); string expectedUrl = "https://data.mobilites-m.fr/api/linesNear/json?x=5.728043&y=45.18432&dist=500&details=True"; //Act LinesNearRequest target = new LinesNearRequest(fakeSendRequest); string actualUrl = target.Url; //Assert Assert.AreEqual(actualUrl, expectedUrl); }
public void ConstructorWithNoValuesReturnsCorrectUrl() { //Arrange ISendRequest fakeSendRequest = new FakeSendRequest(); string line = "SEM:12"; string expectedUrl = "https://data.mobilites-m.fr/api/routers/default/index/routes?codes=SEM:12"; //Act LineDescriptionRequest target = new LineDescriptionRequest(fakeSendRequest, line); string actualUrl = target.Url; //Assert Assert.AreEqual(actualUrl, expectedUrl); }
public void DoRequestWithUrlContainsLinesReturnsCorrectResponse() { //Arrange string url = "http://data.mobilites-m.fr/api/lines/json?types=ligne&codes=SEM_C1 "; FakeSendRequest fakeSendRequest = new FakeSendRequest(url); string expectedResponse = "[{\"id\": \"SEM:12\",\"gtfsId\": \"SEM:12\",\"shortName\": \"12\",\"longName\": \"Eybens Maisons Neuves / Saint-Martin-d'Hères Les Alloves\",\"color\": \"399645\",\"textColor\": \"FFFFFF\",\"mode\": \"BUS\",\"type\": \"PROXIMO\"}]"; //Act string actualResponse = fakeSendRequest.DoRequest(); //Assert Assert.AreEqual(actualResponse, expectedResponse); }
public void DoRequestWithUrlContainsNearLinesReturnsCorrectResponse() { //Arrange string url = "http://data.mobilites-m.fr/api/linesNear/json?x=5.709360123&y=45.176494599999984&dist=400&details=true"; FakeSendRequest fakeSendRequest = new FakeSendRequest(url); string expectedResponse = "[{ \"id\": \"SEM:0844\", \"name\": \"Grenoble, Champs-Elysées\", \"lon\": 5.71025,\"lat\": 45.17794,\"zone\": \"SEM_GENCHAMPSEL\", \"lines\":[\"SEM:12\"]},{ \"id\": \"SEM:0846\",\"name\": \"Grenoble, Salengro\",\"lon\": 5.70893,\"lat\": 45.17557,\"zone\": \"SEM_GENSALENGRO\",\"lines\":[\"SEM:12\"]}]"; //Act string actualResponse = fakeSendRequest.DoRequest(); //Assert Assert.AreEqual(actualResponse, expectedResponse); }
public void ConstructorWithDoubleValuesReturnsCorrectUrl() { //Arrange ISendRequest fakeSendRequest = new FakeSendRequest(); double x = 5.728056; double y = 45.18474; int z = 200; string expectedUrl = "https://data.mobilites-m.fr/api/linesNear/json?x=5.728056&y=45.18474&dist=200&details=True"; //Act LinesNearRequest target = new LinesNearRequest(fakeSendRequest, x, y, z); string actualUrl = target.Url; //Assert Assert.AreEqual(actualUrl, expectedUrl); }
public void ExpectStringOfListReturnsCorrectValues() { //Arrange ISendRequest fakeRequest = new FakeSendRequest(); GetLinesNearDescription target = new GetLinesNearDescription(fakeRequest); List <string> list = new List <string> { "SEM:12", "SEM:16", "SEM:C" }; //act string actualList = target.GetStringFromList(list); //Assert string expectedList = "SEM:12,SEM:16,SEM:C"; Assert.AreEqual(actualList, expectedList); }