public void AsyncMethodPairAppearAsSingleAction()
		{
			IAsyncController controller = new ControllerWithAsyncAction();
			var descriptor = services.ControllerDescriptorProvider.BuildDescriptor(controller);
			Assert.AreEqual(1, descriptor.Actions.Count);
			Assert.AreEqual("Index", descriptor.Actions["Index"].ToString());
		}
예제 #2
0
        public void AsyncMethodPairAppearAsSingleAction()
        {
            IAsyncController controller = new ControllerWithAsyncAction();
            var descriptor = services.ControllerDescriptorProvider.BuildDescriptor(controller);

            Assert.AreEqual(1, descriptor.Actions.Count);
            Assert.AreEqual("Index", descriptor.Actions["Index"].ToString());
        }
예제 #3
0
        public void CanExecuteActionAsynchronously()
        {
            IAsyncController controller = new ControllerWithAsyncAction();

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

            var ar = controller.BeginProcess(engineContext, context);

            context.Async.Result = ar;
            ar.AsyncWaitHandle.WaitOne();
            controller.EndProcess();

            Assert.AreEqual("foo", response.OutputContent);
        }
예제 #4
0
        public void CanExecuteActionAsynchronouslyAndMaintainCurrentCulture()
        {
            IAsyncController controller = new ControllerWithAsyncAction();

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

            Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("de-DE");

            var ar = controller.BeginProcess(engineContext, context);

            context.Async.Result = ar;
            ar.AsyncWaitHandle.WaitOne();
            controller.EndProcess();

            Assert.AreEqual("de-DE", response.OutputContent);
        }
		public void CanExecuteActionAsynchronously()
		{
			IAsyncController controller = new ControllerWithAsyncAction();

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

			var ar = controller.BeginProcess(engineContext, context);
			context.Async.Result = ar;
			ar.AsyncWaitHandle.WaitOne();
			controller.EndProcess();

			Assert.AreEqual("foo", response.OutputContent);
		}
		public void CanExecuteActionAsynchronouslyAndMaintainCurrentCulture()
		{
			IAsyncController controller = new ControllerWithAsyncAction();

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

			Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("de-DE");

			var ar = controller.BeginProcess(engineContext, context);
			context.Async.Result = ar;
			ar.AsyncWaitHandle.WaitOne();
			controller.EndProcess();

			Assert.AreEqual("de-DE", response.OutputContent);
		}