當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。