OK I got the failing test above working but it seems odd. You have to
specify '.FromInterface' explicilty but that seems redundant since you
just specified '.BasedOn':
[Test]
public void ShouldGetAllLocalTasks()
{
var kernel = new DefaultKernel();
kernel.Register(AllTypes.FromAssembly(typeof
(RegistrationTest2).Assembly)
.BasedOn<ILocalTask>()
.WithService
.FromInterface(typeof(ILocalTask)));
Assert.AreNotEqual<int>(0, kernel.GetHandlers(typeof
(ILocalTask)).Length);//pass
}
On Dec 23, 11:45 am, Mike Nichols <[email protected]> wrote:
> I updated my trunk just a few days old and all my AllTypes
> registrations are broken. The first test below fails.
> I have tried BasedOn and it is failing too.
> I did update .net 2,3,3.5 with the most recent service packs, so
> wonder if that might have something to do with it?
> Any ideas?
>
> [Test]
> public void ShouldGetAllLocalTasks()
> {
> kernel = new DefaultKernel();
> kernel.Register(AllTypes.Of<ILocalTask>().FromAssembly
> (Assembly.GetExecutingAssembly()));
> IHandler[] handlers =
> kernel.GetHandlers(typeof(ILocalTask));
> Assert.AreNotEqual(0, handlers.Length);//fails
> }
> [Test]
> public void ShouldRegisterTask()
> {
> kernel = new DefaultKernel();
>
> kernel.Register(Component.For<ILocalTask>().ImplementedBy<Task1>
> ());
> IHandler[] handlers =
> kernel.GetHandlers(typeof(ILocalTask));
> Assert.AreNotEqual(0, handlers.Length);//passes
> }
> public interface ILocalTask { }
> public class Task1 : ILocalTask { }
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---