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
.TestSupport
20 using System
.Collections
;
21 using Castle
.MonoRail
.Framework
.Internal
.Test
;
24 public class TestResponse
: MarshalByRefObject
26 private int statusCode
;
27 private String statusDescription
;
28 private IDictionary propertyBag
;
29 private IDictionary flash
;
30 private IDictionary session
;
31 private IDictionary headers
= new Hashtable();
32 private CookieContainer cookies
= new CookieContainer();
40 get { return statusCode; }
41 set { statusCode = value; }
44 public string StatusDescription
46 get { return statusDescription; }
47 set { statusDescription = value; }
50 public IDictionary Headers
52 get { return headers; }
55 public CookieContainer Cookies
57 get { return cookies; }
60 public IDictionary PropertyBag
62 get { return propertyBag; }
65 public IDictionary Flash
70 public IDictionary Session
72 get { return session; }
75 protected internal void Complete()
77 foreach(DictionaryEntry entry
in headers
)
79 String name
= entry
.Key
.ToString();
81 if ("Set-Cookie".Equals(name
))
83 if (entry
.Value
is IList
)
85 foreach(String
value in (IList
) entry
.Value
)
87 cookies
.SetCookies(new Uri("http://localhost"), value);
94 cookies
.SetCookies(new Uri("http://localhost"), entry
.Value
.ToString());
98 Console
.WriteLine(ex
.ToString());
106 HttpContext context
= TestContextHolder
.Context
;
108 flash
= (IDictionary
) context
.Items
["mr.flash"];
109 session
= (IDictionary
) context
.Items
["mr.session"];
110 propertyBag
= (IDictionary
) context
.Items
["mr.propertybag"];