1 // Copyright 2004-2008 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
.Views
.Brail
.TestSite
.Controllers
17 using System
.Collections
;
18 using System
.Reflection
;
20 using Castle
.DynamicProxy
;
21 using Castle
.MonoRail
.Framework
;
25 public class HomeController
: Controller
27 public void CanUseUrlHelperWithoutPrefix()
34 this.PropertyBag
.Add("CustomerName", "hammett");
35 string[] textArray1
= new string[] { "1", "2", "3" }
;
36 this.PropertyBag
.Add("List", textArray1
);
39 public void ComplexNestedExpressions()
41 PropertyBag
["title"] = "first";
42 PropertyBag
["pageIndex"] = 5;
45 public void ComplexNestedExpressions2()
47 PropertyBag
["title"] = "first";
48 PropertyBag
["pageIndex"] = 5;
53 this.PropertyBag
.Add("CustomerName", "hammett");
54 string[] textArray1
= new string[] { "1", "2", "3" }
;
55 this.PropertyBag
.Add("List", textArray1
);
62 public void HelloFromCommon()
70 public void WithNothingAfterTheLastSeperator()
75 public void WithDynamicProxyObject()
77 ProxyGenerator generator
= new ProxyGenerator();
78 object o
= generator
.CreateClassProxy(typeof(SimpleProxy
),new StandardInterceptor());
81 o
.GetType().GetProperty("Text");
82 throw new InvalidOperationException("Should have gotten AmbiguousMatchException here");
87 PropertyBag
["src"] = o
;
90 public void WithNullableDynamicProxyObject()
92 ProxyGenerator generator
= new ProxyGenerator();
93 SimpleProxy proxy
= (SimpleProxy
)generator
.CreateClassProxy(typeof(SimpleProxy
), new StandardInterceptor());
94 PropertyBag
["src"] = proxy
;
97 public class SimpleProxy
99 private string text
= "BarBaz";
100 readonly Hashtable items
= new Hashtable();
102 public virtual object this[string key
]
104 get { return items[key]; }
105 set{ items[key] = value; }
108 public virtual string Text
114 public virtual string Say()
120 public void NullableProperties()
122 Foo
[] fooArray1
= new Foo
[] { new Foo("Bar"), new Foo(null), new Foo("Baz") }
;
123 this.PropertyBag
.Add("List", fooArray1
);
126 public void Nullables()
128 this.PropertyBag
.Add("doesExists", "foo");
131 public void PreProcessor()
133 this.PropertyBag
.Add("Title", "Ayende");
136 public void RedirectAction()
138 this.Redirect("home", "index");
141 public void RedirectForOtherArea()
143 this.Redirect("subrea", "home", "index");
146 public void ShowEmptyList()
148 this.PropertyBag
.Add("dic", new Hash());
149 this.RenderView("ShowList");
152 public void ShowList()
154 Hashtable values
= new Hashtable();
155 values
.Add("Ayende", "Rahien");
156 values
.Add("Foo", "Bar");
157 this.PropertyBag
.Add("dic", values
);
160 public void Welcome()
162 this.RenderView("heyhello");
165 public void Repeater()
170 public void NamespacesInConfig()
175 public void SubView()
180 public void Javascript()
185 public void Javascript2()
190 public void UsingQuotes()
195 public void DuckOverloadToString()
197 PropertyBag
["birthday"] = new DateTime(1981, 12, 20);
200 public void NullPropagation()