Ejemplo n.º 1
0
        public void VersionHeaderTest()
        {
            Mock <HttpResponseBase> mockResponse = new Mock <HttpResponseBase>();

            mockResponse.Setup(response => response.AppendHeader("X-AspNetWebPages-Version", "3.0")).Verifiable();

            Mock <HttpContextBase> mockContext = new Mock <HttpContextBase>();

            mockContext.SetupGet(context => context.Response).Returns(mockResponse.Object);

            WebPageHttpHandler.AddVersionHeader(mockContext.Object);
            mockResponse.Verify();
        }
Ejemplo n.º 2
0
        public void VersionHeaderTest()
        {
            bool headerSet = false;
            Mock <HttpResponseBase> mockResponse = new Mock <HttpResponseBase>();

            mockResponse.Setup(response => response.AppendHeader("X-AspNetWebPages-Version", "2.0")).Callback(() => headerSet = true);

            Mock <HttpContextBase> mockContext = new Mock <HttpContextBase>();

            mockContext.SetupGet(context => context.Response).Returns(mockResponse.Object);

            WebPageHttpHandler.AddVersionHeader(mockContext.Object);
            Assert.True(headerSet);
        }