Exemplo n.º 1
0
        public API_Moq_HttpContext createBaseMocks()
        {
            MockContext  = new Mock <HttpContextBase>();
            MockRequest  = new MockHttpRequest(); // new Mock<HttpRequestBase>();
            MockResponse = new Mock <HttpResponseBase>();
            MockSession  = new MockHttpSession();
            MockServer   = new Mock <HttpServerUtilityBase>();


            MockContext.Setup(ctx => ctx.Request).Returns(MockRequest);
            MockContext.Setup(ctx => ctx.Response).Returns(MockResponse.Object);
            MockContext.Setup(ctx => ctx.Session).Returns(MockSession);
            MockContext.Setup(ctx => ctx.Server).Returns(MockServer.Object);


            HttpContextBase  = MockContext.Object;
            HttpRequestBase  = MockRequest;
            HttpResponseBase = MockResponse.Object;

            return(this);
        }
Exemplo n.º 2
0
        public API_Moq_HttpContext createBaseMocks()
        {
            MockContext  = new Mock<HttpContextBase>();
            MockRequest  = new MockHttpRequest(); // new Mock<HttpRequestBase>();
            MockResponse = new Mock<HttpResponseBase>();
            MockSession  = new MockHttpSession();
            MockServer   = new Mock<HttpServerUtilityBase>();

            MockContext.Setup(ctx => ctx.Request).Returns(MockRequest);
            MockContext.Setup(ctx => ctx.Response).Returns(MockResponse.Object);
            MockContext.Setup(ctx => ctx.Session).Returns(MockSession);
            MockContext.Setup(ctx => ctx.Server).Returns(MockServer.Object);

            HttpContextBase  = MockContext.Object;
            HttpRequestBase  = MockRequest;
            HttpResponseBase = MockResponse.Object;

            return this;
        }