当前位置: 首页>>代码示例>>C#>>正文


C# AsyncControllerActionInvoker.BeginInvokeAction方法代码示例

本文整理汇总了C#中AsyncControllerActionInvoker.BeginInvokeAction方法的典型用法代码示例。如果您正苦于以下问题:C# AsyncControllerActionInvoker.BeginInvokeAction方法的具体用法?C# AsyncControllerActionInvoker.BeginInvokeAction怎么用?C# AsyncControllerActionInvoker.BeginInvokeAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AsyncControllerActionInvoker的用法示例。


在下文中一共展示了AsyncControllerActionInvoker.BeginInvokeAction方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InvokeAction_ActionThrowsException_ThreadAbort

        public void InvokeAction_ActionThrowsException_ThreadAbort()
        {
            // Arrange
            ControllerContext controllerContext = GetControllerContext();
            AsyncControllerActionInvoker invoker = new AsyncControllerActionInvoker();

            // Act & assert
            Assert.Throws<ThreadAbortException>(
                delegate { invoker.BeginInvokeAction(controllerContext, "ActionCallsThreadAbort", null, null); });
        }
开发者ID:brianly,项目名称:aspnetwebstack,代码行数:10,代码来源:AsyncControllerActionInvokerTest.cs

示例2: InvokeAction_ActionThrowsException_NotHandled

        public void InvokeAction_ActionThrowsException_NotHandled()
        {
            // Arrange
            ControllerContext controllerContext = GetControllerContext();
            AsyncControllerActionInvoker invoker = new AsyncControllerActionInvoker();

            // Act & assert
            Assert.Throws<Exception>(
                delegate { invoker.BeginInvokeAction(controllerContext, "ActionThrowsExceptionAndIsNotHandled", null, null); },
                @"Some exception text.");
        }
开发者ID:brianly,项目名称:aspnetwebstack,代码行数:11,代码来源:AsyncControllerActionInvokerTest.cs

示例3: InvokeAction_ActionNotFound

        public void InvokeAction_ActionNotFound() {
            // Arrange
            ControllerContext controllerContext = GetControllerContext();
            AsyncControllerActionInvoker invoker = new AsyncControllerActionInvoker();

            // Act
            IAsyncResult asyncResult = invoker.BeginInvokeAction(controllerContext, "ActionNotFound", null, null);
            bool retVal = invoker.EndInvokeAction(asyncResult);

            // Assert
            Assert.IsFalse(retVal);
        }
开发者ID:consumentor,项目名称:Server,代码行数:12,代码来源:AsyncControllerActionInvokerTest.cs

示例4: InvokeAction_AuthorizationFilterShortCircuits

        public void InvokeAction_AuthorizationFilterShortCircuits() {
            // Arrange
            ControllerContext controllerContext = GetControllerContext();
            AsyncControllerActionInvoker invoker = new AsyncControllerActionInvoker();

            // Act
            IAsyncResult asyncResult = invoker.BeginInvokeAction(controllerContext, "AuthorizationFilterShortCircuits", null, null);
            bool retVal = invoker.EndInvokeAction(asyncResult);

            // Assert
            Assert.IsTrue(retVal);
            Assert.AreEqual("From authorization filter", ((TestController)controllerContext.Controller).Log);
        }
开发者ID:consumentor,项目名称:Server,代码行数:13,代码来源:AsyncControllerActionInvokerTest.cs

示例5: InvokeAction_ActionThrowsException_Handled

        public void InvokeAction_ActionThrowsException_Handled() {
            // Arrange
            ControllerContext controllerContext = GetControllerContext();
            AsyncControllerActionInvoker invoker = new AsyncControllerActionInvoker();

            // Act & assert
            IAsyncResult asyncResult = invoker.BeginInvokeAction(controllerContext, "ActionThrowsExceptionAndIsHandled", null, null);
            Assert.IsNull(((TestController)controllerContext.Controller).Log, "Result filter shouldn't have executed yet.");

            bool retVal = invoker.EndInvokeAction(asyncResult);
            Assert.IsTrue(retVal);
            Assert.AreEqual("From exception filter", ((TestController)controllerContext.Controller).Log);
        }
开发者ID:consumentor,项目名称:Server,代码行数:13,代码来源:AsyncControllerActionInvokerTest.cs

示例6: InvokeAction_NormalAction

        public void InvokeAction_NormalAction()
        {
            // Arrange
            ControllerContext controllerContext = GetControllerContext();
            AsyncControllerActionInvoker invoker = new AsyncControllerActionInvoker();

            // Act
            IAsyncResult asyncResult = invoker.BeginInvokeAction(controllerContext, "NormalAction", null, null);
            bool retVal = invoker.EndInvokeAction(asyncResult);

            // Assert
            Assert.True(retVal);
            Assert.Equal("From action", ((TestController)controllerContext.Controller).Log);
        }
开发者ID:brianly,项目名称:aspnetwebstack,代码行数:14,代码来源:AsyncControllerActionInvokerTest.cs

示例7: InvokeAction_ThrowsIfControllerContextIsNull

        public void InvokeAction_ThrowsIfControllerContextIsNull()
        {
            // Arrange
            AsyncControllerActionInvoker invoker = new AsyncControllerActionInvoker();

            // Act & assert
            Assert.ThrowsArgumentNull(
                delegate { invoker.BeginInvokeAction(null, "someAction", null, null); }, "controllerContext");
        }
开发者ID:brianly,项目名称:aspnetwebstack,代码行数:9,代码来源:AsyncControllerActionInvokerTest.cs

示例8: InvokeAction_ThrowsIfActionNameIsNull

        public void InvokeAction_ThrowsIfActionNameIsNull()
        {
            // Arrange
            AsyncControllerActionInvoker invoker = new AsyncControllerActionInvoker();

            // Act & assert
            Assert.ThrowsArgumentNullOrEmpty(
                delegate { invoker.BeginInvokeAction(new ControllerContext(), null, null, null); }, "actionName");
        }
开发者ID:brianly,项目名称:aspnetwebstack,代码行数:9,代码来源:AsyncControllerActionInvokerTest.cs

示例9: InvokeAction_ResultThrowsException_Handled

        public void InvokeAction_ResultThrowsException_Handled()
        {
            // Arrange
            ControllerContext controllerContext = GetControllerContext();
            AsyncControllerActionInvoker invoker = new AsyncControllerActionInvoker();

            // Act & assert
            IAsyncResult asyncResult = invoker.BeginInvokeAction(controllerContext, "ResultThrowsExceptionAndIsHandled", null, null);
            bool retVal = invoker.EndInvokeAction(asyncResult);

            Assert.True(retVal);
            Assert.Equal("From exception filter", ((TestController)controllerContext.Controller).Log);
        }
开发者ID:brianly,项目名称:aspnetwebstack,代码行数:13,代码来源:AsyncControllerActionInvokerTest.cs

示例10: InvokeAction_RequestValidationFails

        public void InvokeAction_RequestValidationFails()
        {
            // Arrange
            ControllerContext controllerContext = GetControllerContext(passesRequestValidation: false);
            AsyncControllerActionInvoker invoker = new AsyncControllerActionInvoker();

            // Act & assert
            Assert.Throws<HttpRequestValidationException>(
                delegate { invoker.BeginInvokeAction(controllerContext, "NormalAction", null, null); });
        }
开发者ID:brianly,项目名称:aspnetwebstack,代码行数:10,代码来源:AsyncControllerActionInvokerTest.cs

示例11: InvokeAction_AuthenticationFilterChallenges

        public void InvokeAction_AuthenticationFilterChallenges()
        {
            // Arrange
            ControllerContext controllerContext = GetControllerContext();
            AsyncControllerActionInvoker invoker = new AsyncControllerActionInvoker();

            // Act
            IAsyncResult asyncResult = invoker.BeginInvokeAction(controllerContext, "AuthenticationFilterChallenges", null, null);
            bool retVal = invoker.EndInvokeAction(asyncResult);

            // Assert
            Assert.True(retVal);
            Assert.Equal("From authentication filter challenge", ((TestController)controllerContext.Controller).Log);
        }
开发者ID:huangw-t,项目名称:aspnetwebstack,代码行数:14,代码来源:AsyncControllerActionInvokerTest.cs

示例12: InvokeAction_ThrowsIfActionNameIsEmpty

        public void InvokeAction_ThrowsIfActionNameIsEmpty() {
            // Arrange
            AsyncControllerActionInvoker invoker = new AsyncControllerActionInvoker();

            // Act & assert
            ExceptionHelper.ExpectArgumentExceptionNullOrEmpty(
                delegate {
                    invoker.BeginInvokeAction(new ControllerContext(), "", null, null);
                }, "actionName");
        }
开发者ID:consumentor,项目名称:Server,代码行数:10,代码来源:AsyncControllerActionInvokerTest.cs

示例13: InvokeAction_ResultThrowsException_ThreadAbort

        public void InvokeAction_ResultThrowsException_ThreadAbort() {
            // Arrange
            ControllerContext controllerContext = GetControllerContext();
            AsyncControllerActionInvoker invoker = new AsyncControllerActionInvoker();

            // Act & assert
            IAsyncResult asyncResult = invoker.BeginInvokeAction(controllerContext, "ResultCallsThreadAbort", null, null);
            ExceptionHelper.ExpectException<ThreadAbortException>(
                delegate {
                    invoker.EndInvokeAction(asyncResult);
                });
        }
开发者ID:consumentor,项目名称:Server,代码行数:12,代码来源:AsyncControllerActionInvokerTest.cs

示例14: InvokeAction_ResultThrowsException_NotHandled

        public void InvokeAction_ResultThrowsException_NotHandled() {
            // Arrange
            ControllerContext controllerContext = GetControllerContext();
            AsyncControllerActionInvoker invoker = new AsyncControllerActionInvoker();

            // Act & assert
            IAsyncResult asyncResult = invoker.BeginInvokeAction(controllerContext, "ResultThrowsExceptionAndIsNotHandled", null, null);
            ExceptionHelper.ExpectException<Exception>(
                delegate {
                    invoker.EndInvokeAction(asyncResult);
                },
                @"Some exception text.");
        }
开发者ID:consumentor,项目名称:Server,代码行数:13,代码来源:AsyncControllerActionInvokerTest.cs

示例15: InvokeAction_RequestValidationFails

        public void InvokeAction_RequestValidationFails() {
            // Arrange
            ControllerContext controllerContext = GetControllerContext(false /* passesRequestValidation */);
            AsyncControllerActionInvoker invoker = new AsyncControllerActionInvoker();

            // Act & assert
            ExceptionHelper.ExpectException<HttpRequestValidationException>(
                delegate {
                    invoker.BeginInvokeAction(controllerContext, "NormalAction", null, null);
                });
        }
开发者ID:consumentor,项目名称:Server,代码行数:11,代码来源:AsyncControllerActionInvokerTest.cs


注:本文中的AsyncControllerActionInvoker.BeginInvokeAction方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。