public void WebServerContext_Send_ResponseIsNotNull_InvokesWriteOnResponse() { //------------Setup for test-------------------------- var request = new HttpRequestMessage(HttpMethod.Get, "http://localhost/services") { Content = new StringContent("", Encoding.UTF8) }; var context = new WebServerContext(request, new NameValueCollection()); var response = new Mock<IResponseWriter>(); response.Setup(r => r.Write(It.IsAny<WebServerContext>())).Verifiable(); //------------Execute Test--------------------------- context.Send(response.Object); //------------Assert Results------------------------- response.Verify(r => r.Write(It.IsAny<WebServerContext>())); }
public void WebServerContext_Send_ResponseIsNull_ThrowsArgumentNullException() { //------------Setup for test-------------------------- var request = new HttpRequestMessage(HttpMethod.Get, "http://localhost/services") { Content = new StringContent("", Encoding.UTF8) }; var context = new WebServerContext(request, new NameValueCollection()); //------------Execute Test--------------------------- context.Send(null); //------------Assert Results------------------------- }