Fixed IOC-80 by considering parameter dependencies for valid handler states.
[castle.git] / Facilities / EventWiring / Castle.Facilities.EventWiring.Tests / WiringTestBase.cs
blobcbf478acc6885fddf13b0d16d9d5baec0463d331
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.Facilities.EventWiring.Tests
17 using Castle.Facilities.EventWiring.Tests.Model;
18 using Castle.Windsor;
19 using NUnit.Framework;
21 public abstract class WiringTestBase
23 protected WindsorContainer container;
25 [SetUp]
26 public void Init()
28 container = new WindsorContainer(ConfigHelper.ResolvePath(GetConfigFile()));
31 protected abstract string GetConfigFile();
33 [Test]
34 public void TriggerSimple()
36 SimplePublisher publisher = (SimplePublisher)container["SimplePublisher"];
37 SimpleListener listener = (SimpleListener)container["SimpleListener"];
39 Assert.IsFalse(listener.Listened);
40 Assert.IsNull(listener.Sender);
42 publisher.Trigger();
44 Assert.IsTrue(listener.Listened);
45 Assert.AreSame(publisher, listener.Sender);
48 [Test]
49 public void TriggerStaticEvent()
51 SimplePublisher publisher = (SimplePublisher)container["SimplePublisher"];
52 SimpleListener listener = (SimpleListener)container["SimpleListener2"];
54 Assert.IsFalse(listener.Listened);
55 Assert.IsNull(listener.Sender);
57 publisher.StaticTrigger();
59 Assert.IsTrue(listener.Listened);
60 Assert.AreSame(publisher, listener.Sender);