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
.Facilities
.EventWiring
.Tests
17 using Castle
.Facilities
.EventWiring
.Tests
.Model
;
19 using NUnit
.Framework
;
21 public abstract class WiringTestBase
23 protected WindsorContainer container
;
28 container
= new WindsorContainer(ConfigHelper
.ResolvePath(GetConfigFile()));
31 protected abstract string GetConfigFile();
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
);
44 Assert
.IsTrue(listener
.Listened
);
45 Assert
.AreSame(publisher
, listener
.Sender
);
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
);