public void ControllerCanCancelView()
        {
            var controller = new ControllerAndViews();

            var context = services.ControllerContextFactory.
                          Create("", "home", "CancelsTheView", new ControllerMetaDescriptor());

            controller.Process(engineContext, context);

            Assert.AreEqual(200, response.StatusCode);
            Assert.AreEqual("OK", response.StatusDescription);
            Assert.IsNull(engStubViewEngineManager.TemplateRendered);
        }
		public void RendersViewByDefault()
		{
			ControllerAndViews controller = new ControllerAndViews();

			IControllerContext context = services.ControllerContextFactory.
				Create("", "home", "EmptyAction", new ControllerMetaDescriptor());

			controller.Process(engineContext, context);

			Assert.AreEqual(200, response.StatusCode);
			Assert.AreEqual("OK", response.StatusDescription);
			Assert.AreEqual("home\\EmptyAction", engStubViewEngineManager.TemplateRendered);
		}
        public void ControllerCanOverrideView()
        {
            var controller = new ControllerAndViews();

            var context = services.ControllerContextFactory.
                          Create("", "home", "ActionWithViewOverride", new ControllerMetaDescriptor());

            controller.Process(engineContext, context);

            Assert.AreEqual(200, response.StatusCode);
            Assert.AreEqual("OK", response.StatusDescription);
            Assert.AreEqual("home\\SomethingElse", engStubViewEngineManager.TemplateRendered);
        }
        public void RendersViewByDefault()
        {
            var controller = new ControllerAndViews();

            var context = services.ControllerContextFactory.
                          Create("", "home", "EmptyAction", new ControllerMetaDescriptor());

            controller.Process(engineContext, context);

            Assert.AreEqual(200, response.StatusCode);
            Assert.AreEqual("OK", response.StatusDescription);
            Assert.AreEqual("home\\EmptyAction", engStubViewEngineManager.TemplateRendered);
        }
        public void RendersInferredViewIfTemplateExists()
        {
            var controller = new ControllerAndViews();

            var context = services.ControllerContextFactory.
                          Create("", "home", "InferredAction", new ControllerMetaDescriptor());

            engStubViewEngineManager.RegisterTemplate("home\\InferredAction");

            controller.Process(engineContext, context);

            Assert.AreEqual(200, response.StatusCode);
            Assert.AreEqual("OK", response.StatusDescription);
            Assert.AreEqual("home\\InferredAction", engStubViewEngineManager.TemplateRendered);
        }
        public void RendersInferredView_IfTemplateDoesNotExistsResultsIn404()
        {
            var controller = new ControllerAndViews();

            var context = services.ControllerContextFactory.
                          Create("", "home", "InferredAction", new ControllerMetaDescriptor());

            try
            {
                controller.Process(engineContext, context);
                Assert.Fail("Should have thrown a 404.");
            }
            catch (HttpException)
            {
                Assert.AreEqual(404, response.StatusCode);
            }
        }
예제 #7
0
		public void InvokingNonExistingActionResultsIn404()
		{
			var controller = new ControllerAndViews();

			var context = new DefaultControllerContextFactory().
				Create("", "home", "NonExistentAction", new ControllerMetaDescriptor());

			try
			{
				controller.Process(engineContext, context);
			}
			catch(MonoRailException)
			{
				Assert.AreEqual(404, response.StatusCode);

				throw;
			}
		}
        public void InvokingNonExistingActionResultsIn404()
        {
            var controller = new ControllerAndViews();

            var context = new DefaultControllerContextFactory().
                          Create("", "home", "NonExistentAction", new ControllerMetaDescriptor());

            try
            {
                controller.Process(engineContext, context);
            }
            catch (MonoRailException)
            {
                Assert.AreEqual(404, response.StatusCode);

                throw;
            }
        }
예제 #9
0
		public void RendersInferredView_IfTemplateDoesNotExistsResultsIn404()
		{
			var controller = new ControllerAndViews();

			var context = services.ControllerContextFactory.
				Create("", "home", "InferredAction", new ControllerMetaDescriptor());

			try
			{
				controller.Process(engineContext, context);
				Assert.Fail("Should have thrown a 404.");
			}
			catch (HttpException)
			{
				Assert.AreEqual(404, response.StatusCode);
			}
		}
예제 #10
0
		public void RendersInferredViewIfTemplateExists()
		{
			var controller = new ControllerAndViews();

			var context = services.ControllerContextFactory.
				Create("", "home", "InferredAction", new ControllerMetaDescriptor());

			engStubViewEngineManager.RegisterTemplate("home\\InferredAction");

			controller.Process(engineContext, context);

			Assert.AreEqual(200, response.StatusCode);
			Assert.AreEqual("OK", response.StatusDescription);
			Assert.AreEqual("home\\InferredAction", engStubViewEngineManager.TemplateRendered);
		}
예제 #11
0
		public void ControllerCanCancelView()
		{
			var controller = new ControllerAndViews();

			var context = services.ControllerContextFactory.
				Create("", "home", "CancelsTheView", new ControllerMetaDescriptor());

			controller.Process(engineContext, context);

			Assert.AreEqual(200, response.StatusCode);
			Assert.AreEqual("OK", response.StatusDescription);
			Assert.IsNull(engStubViewEngineManager.TemplateRendered);
		}
예제 #12
0
		public void ControllerCanOverrideView()
		{
			var controller = new ControllerAndViews();

			var context = services.ControllerContextFactory.
				Create("", "home", "ActionWithViewOverride", new ControllerMetaDescriptor());

			controller.Process(engineContext, context);

			Assert.AreEqual(200, response.StatusCode);
			Assert.AreEqual("OK", response.StatusDescription);
			Assert.AreEqual("home\\SomethingElse", engStubViewEngineManager.TemplateRendered);
		}