Send() public method

public Send ( IResponseWriter response ) : void
response IResponseWriter
return void
コード例 #1
0
        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>()));
        }
コード例 #2
0
        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-------------------------
        }