1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
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
7 // http://www.apache.org/licenses/LICENSE-2.0
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
;
23 public class WizardSupportTestCase
: AbstractTestCase
26 public void StartRedirectsToFirstPage()
28 DoGet("testwizard/start.rails");
29 AssertRedirectedTo("/testwizard/Page1.rails");
33 public void UnrelatedWizardActionInvocation()
35 DoGet("testwizard/index.rails");
36 AssertReplyEqualTo("Hello!");
40 public void Page1HasCorrectIndex()
42 DoGet("testwizard/Page1.rails");
44 AssertSessionEntryEqualsTo("wizard.testwizardcurrentstepindex", 0);
45 AssertSessionEntryEqualsTo("wizard.testwizardcurrentstep", "Page1");
47 // Yes, we invoke it twice
49 DoGet("testwizard/Page1.rails");
51 AssertSessionEntryEqualsTo("wizard.testwizardcurrentstepindex", 0);
52 AssertSessionEntryEqualsTo("wizard.testwizardcurrentstep", "Page1");
54 DoGet("testwizard/Page2.rails");
56 AssertSessionEntryEqualsTo("wizard.testwizardcurrentstepindex", 1);
57 AssertSessionEntryEqualsTo("wizard.testwizardcurrentstep", "Page2");
61 public void InnerActionsWithNoView()
63 DoGet("testwizard/Page1.rails");
64 AssertFlashDoesNotContain("InnerActionInvoked");
67 // Yes, we invoke it twice
69 DoGet("testwizard/Page1.rails");
71 AssertFlashDoesNotContain("InnerActionInvoked");
73 DoGet("testwizard/Page1-InnerAction.rails");
75 AssertFlashContains("InnerActionInvoked");
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");
95 public void InnerActionsWithView()
97 DoGet("testwizard/Page1-InnerAction2.rails");
99 AssertReplyEqualTo("View for Inner action 2");
103 public void WizardPageWithView()
105 DoGet("testwizard/Page3.rails");
107 AssertReplyEqualTo("Wizard page 3");
111 public void WizardHelper_HasNextAndPreviousSteps()
113 DoGet("testwizard/Page4.rails");
115 AssertReplyEqualTo("hasprevious True\r\nhasnext False");