public void Execute_RealModelSample_GetContentNoException() { var httpClient = new HttpClient(); var workUnit = new A0httpRequest(httpClient); var inModel = new Input { Id = "MD619865" }; var result = (ParserExecutorResultBase) new Site911Result(); var firstResult = (A0httpResponse)(workUnit.Execute(inModel, ref result)); Assert.IsNull(result.Exception); Assert.IsTrue(firstResult.Html.Length > 0); }
public void Initialize() { // Note: need to find something better, - such test knows about inner usage of id, maybe better setup is [InputModel] = HttpResponseMessage // alternatively just use Moq var handlerMock = new HttpMessageHandlerMock(new Dictionary <string, HttpResponseMessage> { ["http://911auto.com.ua/search/ok"] = new HttpResponseMessage { Content = new StringContent("html content"), StatusCode = HttpStatusCode.OK }, ["http://911auto.com.ua/search/exception"] = new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError } }); var httpClient = new HttpClient(handlerMock); workUnit = new A0httpRequest(httpClient); }