This test fails. It fails due to the ClosedTypeDataService closing
IDataService and here is the error. As you can see, kernel is not
seeing the service name to resolve. Is this due to the CLR bug with
Generic type GenericTypeDefinition ? If so, how do you get around this
without resorting to injecting the IKernel? I see in the handler that
the ctor dependency FullName is 'null' but trying to register with the
GenericTypeDefinition doesn't work either....Should I post a donjon?

ERROR:
        RegistrationServiceTest+SomeAppServiceImpl is waiting for the
following dependencies:

        Services:
        - RegistrationServiceTest+ISomeDomainService`1
[[RegistrationServiceTest+DomainObj, Test, Version=0.6.0.0,
Culture=neutral, PublicKeyToken=null]] which was registered but is
also waiting for dependencies.

        RegistrationServiceTest+SomDomainServiceImpl`1 is waiting for the
following dependencies:

        Services:
        -  which was not registered.


                [Test]
                public void should_resolved_generic_types()
                {
                        kernel = new DefaultKernel();
                        kernel.Register(
                                
AllTypes.FromAssembly(GetType().Assembly).BasedOn<IMarker>(),
                                
Component.For(typeof(IDataService<DomainObj>)).ImplementedBy(typeof
(ClosedTypeDataService)),
                                
Component.For(typeof(ISomeDomainService<>)).ImplementedBy(typeof
(SomeDomainServiceImpl<>)));

                        var handler = kernel.GetAssignableHandlers(typeof
(ISomeAppService<Msg>))[0];
                        var service = handler.Resolve(CreationContext.Empty);
                        Assert.IsInstanceOfType(typeof(SomeAppServiceImpl), 
service);
                }


                public class Msg { }
                public class DomainObj { }

                public interface ISomeDomainService<T> { }
                public interface IDataService<T> { }
                public interface IMarker { }
                public interface ISomeAppService<T> : IMarker { }

                public class SomeAppServiceImpl : ISomeAppService<Msg>
                {
                        public SomeAppServiceImpl(ISomeDomainService<DomainObj> 
cmd)
                        {
                        }
                }

                public class SomeDomainServiceImpl<T> : ISomeDomainService<T>
                {
                        public SomeDomainServiceImpl(IDataService<T> inner)
                        {
                        }
                }
                public class ClosedTypeDataService : IDataService<DomainObj> { }
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to