Fix the build.
[castle.git] / MonoRail / Castle.MonoRail.Framework / Test / MockViewEngine.cs
blob7afd608a2029ffef0e6d1d696c9e4c5ba7c8b13f
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.Framework.Test
17 using System;
18 using System.IO;
20 /// <summary>
21 /// Represents a mock implementation of <see cref="IViewEngine"/> for unit test purposes.
22 /// </summary>
23 public class MockViewEngine : IViewEngine
25 private string viewFileExtension;
26 private string jsGeneratorFileExtension;
27 private bool supportsJSGeneration;
28 private bool xHtmlRendering;
30 /// <summary>
31 /// Initializes a new instance of the <see cref="MockViewEngine"/> class.
32 /// </summary>
33 /// <param name="viewFileExtension">The view file extension.</param>
34 /// <param name="jsGeneratorFileExtension">The js generator file extension.</param>
35 /// <param name="supportsJSGeneration">if set to <c>true</c> [supports JS generation].</param>
36 /// <param name="xHtmlRendering">if set to <c>true</c> [x HTML rendering].</param>
37 public MockViewEngine(string viewFileExtension, string jsGeneratorFileExtension, bool supportsJSGeneration, bool xHtmlRendering)
39 this.viewFileExtension = viewFileExtension;
40 this.jsGeneratorFileExtension = jsGeneratorFileExtension;
41 this.supportsJSGeneration = supportsJSGeneration;
42 this.xHtmlRendering = xHtmlRendering;
45 /// <summary>
46 /// Gets a value indicating whether the view engine
47 /// support the generation of JS.
48 /// </summary>
49 /// <value>
50 /// <c>true</c> if JS generation is supported; otherwise, <c>false</c>.
51 /// </value>
52 public virtual bool SupportsJSGeneration
54 get { return supportsJSGeneration; }
57 /// <summary>
58 /// Gets or sets a value indicating whether the view engine should set the
59 /// content type to xhtml.
60 /// </summary>
61 /// <value>
62 /// <c>true</c> if the content type should be set to xhtml; otherwise, <c>false</c>.
63 /// </value>
64 public bool XHtmlRendering
66 get { return xHtmlRendering; }
67 set { xHtmlRendering = value; }
70 /// <summary>
71 /// Gets the view template file extension.
72 /// </summary>
73 /// <value>The view file extension.</value>
74 public virtual string ViewFileExtension
76 get { return viewFileExtension; }
79 /// <summary>
80 /// Gets the JS generator view template file extension.
81 /// </summary>
82 /// <value>The JS generator file extension.</value>
83 public virtual string JSGeneratorFileExtension
85 get { return jsGeneratorFileExtension; }
88 /// <summary>
89 /// Evaluates whether the specified template exists.
90 /// </summary>
91 /// <param name="templateName"></param>
92 /// <returns><c>true</c> if it exists</returns>
93 public virtual bool HasTemplate(string templateName)
95 throw new NotImplementedException();
98 /// <summary>
99 /// Evaluates whether the specified template can be used to generate js.
100 /// </summary>
101 /// <returns><c>true</c> if it exists</returns>
102 public virtual bool IsTemplateForJSGeneration(String templateName)
104 throw new NotImplementedException();
106 /// <summary>
107 /// Processes the view - using the templateName
108 /// to obtain the correct template,
109 /// and using the context to output the result.
110 /// </summary>
111 /// <param name="context"></param>
112 /// <param name="controller"></param>
113 /// <param name="templateName"></param>
114 public virtual void Process(IRailsEngineContext context, IController controller, string templateName)
116 throw new NotImplementedException();
119 /// <summary>
120 /// Processes the view - using the templateName
121 /// to obtain the correct template
122 /// and writes the results to the <see cref="TextWriter"/>.
123 /// No layout is applied!
124 /// </summary>
125 /// <param name="output"></param>
126 /// <param name="context"></param>
127 /// <param name="controller"></param>
128 /// <param name="templateName"></param>
129 public virtual void Process(TextWriter output, IRailsEngineContext context, IController controller, string templateName)
131 throw new NotImplementedException();
134 /// <summary>
135 /// Implementors should return a generator instance if
136 /// the view engine supports JS generation.
137 /// </summary>
138 /// <param name="context">The request context.</param>
139 /// <returns>A JS generator instance</returns>
140 public virtual object CreateJSGenerator(IRailsEngineContext context)
142 throw new NotImplementedException();
145 /// <summary>
146 /// Processes the js generation view template - using the templateName
147 /// to obtain the correct template, and using the context to output the result.
148 /// </summary>
149 /// <param name="context">The request context.</param>
150 /// <param name="controller">The controller.</param>
151 /// <param name="templateName">Name of the template.</param>
152 public virtual void GenerateJS(IRailsEngineContext context, IController controller, string templateName)
154 throw new NotImplementedException();
157 /// <summary>
158 /// Processes the js generation view template - using the templateName
159 /// to obtain the correct template, and using the specified <see cref="TextWriter"/>
160 /// to output the result.
161 /// </summary>
162 /// <param name="output">The output.</param>
163 /// <param name="context">The request context.</param>
164 /// <param name="controller">The controller.</param>
165 /// <param name="templateName">Name of the template.</param>
166 public virtual void GenerateJS(TextWriter output, IRailsEngineContext context, IController controller, string templateName)
168 throw new NotImplementedException();
171 /// <summary>
172 /// Should process the specified partial. The partial name must contains
173 /// the path relative to the views folder.
174 /// </summary>
175 /// <param name="output">The output.</param>
176 /// <param name="context">The request context.</param>
177 /// <param name="controller">The controller.</param>
178 /// <param name="partialName">The partial name.</param>
179 public virtual void ProcessPartial(TextWriter output, IRailsEngineContext context, IController controller, string partialName)
181 throw new NotImplementedException();
184 /// <summary>
185 /// Wraps the specified content in the layout using
186 /// the context to output the result.
187 /// </summary>
188 /// <param name="context">The request context.</param>
189 /// <param name="controller">The controller.</param>
190 /// <param name="contents">Content to output</param>
191 public virtual void ProcessContents(IRailsEngineContext context, IController controller, string contents)
193 throw new NotImplementedException();