Minor changes to improve testability of helpers
[castle.git] / MonoRail / Castle.MonoRail.WindsorExtension.Tests / WizardSupportTestCase.cs
blob89a9f2518c6f03e70c45802a6f33f4ba7d25516d
1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle.MonoRail.WindsorExtension.Tests
17 using Castle.MonoRail.Framework.Tests;
18 using NUnit.Framework;
20 using Castle.MonoRail.TestSupport;
22 [TestFixture]
23 public class WizardSupportTestCase : AbstractTestCase
25 [Test]
26 public void StartRedirectsToFirstPage()
28 DoGet("testwizard/start.rails");
29 AssertRedirectedTo("/testwizard/Page1.rails");
32 [Test]
33 public void UnrelatedWizardActionInvocation()
35 DoGet("testwizard/index.rails");
36 AssertReplyEqualTo("Hello!");
39 [Test]
40 public void Page1HasCorrectIndex()
42 DoGet("testwizard/Page1.rails");
43 AssertSuccess();
44 AssertSessionEntryEqualsTo("wizard.testwizardcurrentstepindex", 0);
45 AssertSessionEntryEqualsTo("wizard.testwizardcurrentstep", "Page1");
47 // Yes, we invoke it twice
49 DoGet("testwizard/Page1.rails");
50 AssertSuccess();
51 AssertSessionEntryEqualsTo("wizard.testwizardcurrentstepindex", 0);
52 AssertSessionEntryEqualsTo("wizard.testwizardcurrentstep", "Page1");
54 DoGet("testwizard/Page2.rails");
55 AssertSuccess();
56 AssertSessionEntryEqualsTo("wizard.testwizardcurrentstepindex", 1);
57 AssertSessionEntryEqualsTo("wizard.testwizardcurrentstep", "Page2");
60 [Test]
61 public void InnerActionsWithNoView()
63 DoGet("testwizard/Page1.rails");
64 AssertFlashDoesNotContain("InnerActionInvoked");
65 AssertSuccess();
67 // Yes, we invoke it twice
69 DoGet("testwizard/Page1.rails");
70 AssertSuccess();
71 AssertFlashDoesNotContain("InnerActionInvoked");
73 DoGet("testwizard/Page1-InnerAction.rails");
74 AssertSuccess();
75 AssertFlashContains("InnerActionInvoked");
78 [Test]
79 public void NavigateToURI()
81 DoGet("testwizard/Page4-InnerAction.rails", "navigate.to=uri:testwizard/Page3.rails" );
82 AssertRedirectedTo("/testwizard/testwizard/Page3.rails");
83 AssertFlashContains("InnerActionInvoked");
85 DoGet("testwizard/Page4-InnerAction.rails", "navigate.to=uri:/testwizard/Page3.rails" );
86 AssertRedirectedTo("/testwizard/Page3.rails");
87 AssertFlashContains("InnerActionInvoked");
89 DoGet("testwizard/Page4-InnerAction.rails", "navigate.to=uri:http://google/" );
90 AssertRedirectedTo("http://google/");
91 AssertFlashContains("InnerActionInvoked");
94 [Test]
95 public void InnerActionsWithView()
97 DoGet("testwizard/Page1-InnerAction2.rails");
98 AssertSuccess();
99 AssertReplyEqualTo("View for Inner action 2");
102 [Test]
103 public void WizardPageWithView()
105 DoGet("testwizard/Page3.rails");
106 AssertSuccess();
107 AssertReplyEqualTo("Wizard page 3");
110 [Test]
111 public void WizardHelper_HasNextAndPreviousSteps()
113 DoGet("testwizard/Page4.rails");
114 AssertSuccess();
115 AssertReplyEqualTo("hasprevious True\r\nhasnext False");