public void AglService_RequestWithInvalidAddress() { _appConfigMock.Setup(i => i.AglApiUrl).Returns("http://agl-developer-test.azurewebsites.netyyyyyy"); AglService agl = new AglService(_appConfigMock.Object, new RestClient()); var response = agl.Get <List <PeopleDto> >("People"); Assert.IsNull(response); }
public void AglService_RequestWithInvalidResource() { _appConfigMock.Setup(i => i.AglApiUrl).Returns("http://agl-developer-test.azurewebsites.net"); //_restClientMock.Setup(i => i.Execute(It.IsAny<RestRequest>()).Content).Returns(JsonConvert.SerializeObject(payloadWithCatsAndDogs)); AglService agl = new AglService(_appConfigMock.Object, new RestClient()); var response = agl.Get <List <PeopleDto> >("Test"); Assert.IsNull(response); }
public void AglService_Request() { _appConfigMock.Setup(i => i.AglApiUrl).Returns("http://agl-developer-test.azurewebsites.netyyyyyy"); _restClientMock.Setup(i => i.Execute(It.IsAny <RestRequest>()).StatusCode).Returns(HttpStatusCode.OK); _restClientMock.Setup(i => i.Execute(It.IsAny <RestRequest>()).Content).Returns(JsonConvert.SerializeObject(payloadWithCatsAndDogs)); AglService agl = new AglService(_appConfigMock.Object, _restClientMock.Object); var response = agl.Get <List <PeopleDto> >("Test"); Assert.AreEqual(3, response.Count); }