1 namespace Castle
.MonoRail
.Views
.Brail
.Tests
3 using System
.Configuration
;
10 public class DslFixture
: BaseControllerTest
13 public void CanOutputParagraphWithClassAttribute()
15 BooViewEngine bve
= new BooViewEngine();
16 string viewPath
= Path
.Combine(ConfigurationManager
.AppSettings
["tests.src"], "Views");
17 bve
.Service(new ViewSourceLoaderServiceProvider(viewPath
));
19 StringWriter sw
= new StringWriter();
20 DslController controller
= new DslController();
21 PrepareController(controller
, "", "dsl", "attributeOutput");
22 bve
.Process(sw
, Context
, controller
, "dsl/attributeOutput");
23 Assert
.AreEqual("<html><p class=\"foo\">hello world</p></html>", sw
.ToString());
27 public void ParametersCanBeReferencedByView()
29 BooViewEngine bve
= new BooViewEngine();
30 string viewPath
= Path
.Combine(ConfigurationManager
.AppSettings
["tests.src"], "Views");
31 bve
.Service(new ViewSourceLoaderServiceProvider(viewPath
));
33 StringWriter sw
= new StringWriter();
34 DslController controller
= new DslController();
35 controller
.PropertyBag
["SayHelloTo"] = "Harris";
36 PrepareController(controller
, "", "dsl", "expandParameters");
37 bve
.Process(sw
, Context
, controller
, "dsl/expandParameters");
38 Assert
.AreEqual("<html><p>hello, Harris</p></html>", sw
.ToString());
42 public void RegisterHtmlAllowsCallToHtml()
44 BooViewEngine bve
= new BooViewEngine();
45 string viewPath
= Path
.Combine(ConfigurationManager
.AppSettings
["tests.src"], "Views");
46 bve
.Service(new ViewSourceLoaderServiceProvider(viewPath
));
48 StringWriter sw
= new StringWriter();
49 DslController controller
= new DslController();
50 PrepareController(controller
, "", "dsl", "registerHtml");
51 bve
.Process(sw
, Context
, controller
, "dsl/registerHtml");
52 Assert
.AreEqual(@"<html>hello world</html>", sw
.ToString());