예제 #1
0
        public void BeginActionThrowsException()
        {
            IAsyncController controller = new ControllerWithAsyncActionThrowOnBegin();

            var context = services.ControllerContextFactory.
                          Create("", "ControllerWithAsyncAction", "index", services.ControllerDescriptorProvider.BuildDescriptor(controller));
            var exceptionCaught = false;

            services.ExtensionManager.ActionException += delegate { exceptionCaught = true; };

            try
            {
                controller.BeginProcess(engineContext, context);
                Assert.Fail("Expected exception");
            }
            catch (Exception)
            {
            }

            Assert.IsTrue(exceptionCaught);
        }
		public void BeginActionThrowsException()
		{
			IAsyncController controller = new ControllerWithAsyncActionThrowOnBegin();

			var context = services.ControllerContextFactory.
				Create("", "ControllerWithAsyncAction", "index", services.ControllerDescriptorProvider.BuildDescriptor(controller));
			var exceptionCaught = false;
			services.ExtensionManager.ActionException += delegate { exceptionCaught = true; };

			try
			{
				controller.BeginProcess(engineContext, context);
				Assert.Fail("Expected exception");
			}
			catch(Exception)
			{
			}

			Assert.IsTrue(exceptionCaught);
		}