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
.Framework
.Tests
17 using NUnit
.Framework
;
19 using Castle
.MonoRail
.Framework
;
22 public class FlashTestCase
25 public void SimpleTest()
27 Flash flash
= new Flash();
29 flash
["test"] = "hello";
33 Assert
.IsTrue( flash
.ContainsKey("test") );
35 flash
= new Flash(flash
);
37 Assert
.IsTrue( flash
.ContainsKey("test") );
41 public void FlashNow()
43 Flash flash
= new Flash();
45 flash
.Now("test","hello");
47 Assert
.IsTrue( flash
.ContainsKey("test") );
51 Assert
.IsFalse( flash
.ContainsKey("test") );
55 public void FlashKeep()
57 Flash flash
= new Flash();
59 flash
.Now("test1","hello");
60 flash
.Now("test2","hello");
66 Assert
.IsTrue( flash
.ContainsKey("test1") );
67 Assert
.IsFalse( flash
.ContainsKey("test2") );
69 flash
= new Flash(flash
);
72 Assert
.IsTrue( flash
.Count
== 0 );
74 flash
.Now("test1","hello");
75 flash
.Now("test2","hello");
81 Assert
.IsTrue( flash
.ContainsKey("test1") );
82 Assert
.IsTrue( flash
.ContainsKey("test2") );
86 public void FlashDiscard()
88 Flash flash
= new Flash();
90 flash
.Add("test1","hello");
91 flash
.Add("test2","hello");
93 flash
.Discard("test2");
97 Assert
.IsTrue( flash
.ContainsKey("test1") );
98 Assert
.IsFalse( flash
.ContainsKey("test2") );
100 flash
= new Flash(flash
);
103 Assert
.IsTrue( flash
.Count
== 0 );
105 flash
.Add("test1","hello");
106 flash
.Add("test2","hello");
110 flash
= new Flash(flash
);
113 Assert
.IsFalse( flash
.ContainsKey("test1") );
114 Assert
.IsFalse( flash
.ContainsKey("test2") );