Esempio n. 1
0
		public void Controller_RedirectToAction_Honors_Extensionless_Urls()
		{
			services.UrlBuilder.UseExtensions = false;

			var controller = new ControllerWithRedirect();

			var context = services.ControllerContextFactory.
				Create("", "home", "RedirectToAction", services.ControllerDescriptorProvider.BuildDescriptor(controller));

			engineContext.CurrentController = controller;
			engineContext.CurrentControllerContext = context;

			controller.Process(engineContext, context);

			Assert.IsTrue(response.WasRedirected);
			Assert.That(response.RedirectedTo, Is.EqualTo("/home/action"));
		}
Esempio n. 2
0
		public void Controller_RedirectToAction_With_Specified_Anchor_Using_NameValueCollection()
		{
			services.UrlBuilder.UseExtensions = false;

			var controller = new ControllerWithRedirect();

			var context = services.ControllerContextFactory.
				Create("", "home", "RedirectToActionWithAnchorPassingNameValueCollection", services.ControllerDescriptorProvider.BuildDescriptor(controller));

			engineContext.CurrentController = controller;
			engineContext.CurrentControllerContext = context;

			controller.Process(engineContext, context);

			Assert.IsTrue(response.WasRedirected);
			Assert.That(response.RedirectedTo, Is.EqualTo("/home/action?id=1#tab1"));
		}