public void Aspects_ShouldWorkWithGenericServices(Lifetime lifetime) { Container.Service(typeof(IMyGenericService <>), typeof(MyGenericService <>), lifetime); Assert.That(Container.Get(typeof(IMyGenericService <>)).Factory, Is.Null); IMyGenericService <int> instance = (IMyGenericService <int>)Container .Get <IMyGenericService <int> >(QueryModes.AllowSpecialization) .Factory .Invoke(new Mock <IInjector>(MockBehavior.Strict).Object, typeof(IMyService)); Assert.That(instance, Is.Not.Null); Assert.That(instance, Is.InstanceOf <InterfaceInterceptor <IMyGenericService <int> > >()); instance = ((InterfaceInterceptor <IMyGenericService <int> >)instance).Target; Assert.That(instance, Is.Not.Null); Assert.That(instance, Is.InstanceOf <MyGenericService <int> >()); }
public void OnNext(IMyGenericService <string, int> value) { value.ShouldBeOfType <MyGenericService <string, int> >(); }