public void Response_Returns_InstanceProvided() { // Arrange using (HttpResponseMessage expectedResponse = CreateResponse()) { MessageResult result = new MessageResult(expectedResponse); // Act HttpResponseMessage response = result.Response; // Assert Assert.Same(expectedResponse, response); } }
public void ExecuteAsync_Returns_InstanceProvided() { // Arrange using (HttpResponseMessage expectedResponse = CreateResponse()) { IHttpActionResult result = new MessageResult(expectedResponse); // Act Task<HttpResponseMessage> task = result.ExecuteAsync(CancellationToken.None); // Assert Assert.NotNull(task); task.WaitUntilCompleted(); using (HttpResponseMessage response = task.Result) { Assert.Same(expectedResponse, response); } } }