コード例 #1
0
        public void ElmahResult_ExecuteResult_ControllerContextIsNull()
        {
            // Arrange
            ControllerContext controllerContext = null;
            var elmahResult = new ElmahResult();

            // Assert
            Assert.DoesNotThrow(() => elmahResult.ExecuteResult(controllerContext));
        }
コード例 #2
0
        public void ElmahResult_ExecuteResult_ControllerContextIsNull()
        {
            // Arrange
            ControllerContext controllerContext = null;
            var elmahResult = new ElmahResult();

            // Assert
            Assert.DoesNotThrow(() => elmahResult.ExecuteResult(controllerContext));
        }
コード例 #3
0
        public void ElmahResult_ExecuteResult_HttpContextIsNull()
        {
            // Arrange
            var mock = new Mock<ControllerContext>();
            mock.Setup(x => x.HttpContext).Returns(() => null);
            var elmahResult = new ElmahResult();

            // Assert
            Assert.DoesNotThrow(() => elmahResult.ExecuteResult(mock.Object));
        }
コード例 #4
0
        public void ElmahResult_ExecuteResult_HttpContextIsNull()
        {
            // Arrange
            var mock = new Mock <ControllerContext>();

            mock.Setup(x => x.HttpContext).Returns(() => null);
            var elmahResult = new ElmahResult();

            // Assert
            Assert.DoesNotThrow(() => elmahResult.ExecuteResult(mock.Object));
        }
コード例 #5
0
        public void ElmahResult_ExecuteResult_RouteDataIsNull()
        {
            // Arrange
            var request = new Mock<HttpRequestBase>();
            request.Setup(x => x.HttpMethod).Returns("GET");
            var httpContextBase = new Mock<HttpContextBase>();
            httpContextBase.Setup(x => x.Request).Returns(request.Object);
            var controllerContext = new Mock<ControllerContext>();
            controllerContext.Setup(x => x.RouteData).Returns(() => null);
            controllerContext.Setup(x => x.HttpContext).Returns(httpContextBase.Object);
            var elmahResult = new ElmahResult();

            // Assert
            Assert.DoesNotThrow(() => elmahResult.ExecuteResult(controllerContext.Object));
        }
コード例 #6
0
        public void ElmahResult_ExecuteResult_RouteDataIsNull()
        {
            // Arrange
            var request = new Mock <HttpRequestBase>();

            request.Setup(x => x.HttpMethod).Returns("GET");
            var httpContextBase = new Mock <HttpContextBase>();

            httpContextBase.Setup(x => x.Request).Returns(request.Object);
            var controllerContext = new Mock <ControllerContext>();

            controllerContext.Setup(x => x.RouteData).Returns(() => null);
            controllerContext.Setup(x => x.HttpContext).Returns(httpContextBase.Object);
            var elmahResult = new ElmahResult();

            // Assert
            Assert.DoesNotThrow(() => elmahResult.ExecuteResult(controllerContext.Object));
        }
コード例 #7
0
        public void ElmahResult_ExecuteResult_ResourceNullActionEqualsDetail()
        {
            // Arrange
            var request = new Mock<HttpRequestBase>();
            request.Setup(x => x.HttpMethod).Returns("GET");
            request.Setup(x => x.Path).Returns(@"elmah/detail/detail/stylesheet");
            request.Setup(x => x.QueryString).Returns(new NameValueCollection());
            var httpContextBase = new Mock<HttpContextBase>();
            httpContextBase.Setup(x => x.Request).Returns(request.Object);
            var routeData = new RouteData();
            routeData.Values.Add("action", "Detail");
            var controllerContext = new Mock<ControllerContext>();
            controllerContext.Setup(x => x.RouteData).Returns(routeData);
            controllerContext.Setup(x => x.HttpContext).Returns(httpContextBase.Object);
            var elmahResult = new ElmahResult();

            // Assert
            Assert.DoesNotThrow(() => elmahResult.ExecuteResult(controllerContext.Object));
        }
コード例 #8
0
        public void ElmahResult_ExecuteResult_ResourceNull()
        {
            // Arrange
            var request = new Mock <HttpRequestBase>();

            request.Setup(x => x.HttpMethod).Returns("GET");
            request.Setup(x => x.Path).Returns(@"elmah/detail/detail/stylesheet/");
            request.Setup(x => x.QueryString).Returns(new NameValueCollection());
            var httpContextBase = new Mock <HttpContextBase>();

            httpContextBase.Setup(x => x.Request).Returns(request.Object);
            var controllerContext = new Mock <ControllerContext>();

            controllerContext.Setup(x => x.RouteData).Returns(() => null);
            controllerContext.Setup(x => x.HttpContext).Returns(httpContextBase.Object);
            var elmahResult = new ElmahResult();

            // Assert
            Assert.DoesNotThrow(() => elmahResult.ExecuteResult(controllerContext.Object));
        }