Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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);
		}