public void UsingDefaultConventionsResolvesCorrectly() { using ( IKernel kernel = new StandardKernel() ) { var scanner = new AssemblyScanner(); scanner.Assembly( Assembly.GetExecutingAssembly() ); scanner.UsingDefaultConventions(); kernel.Scan( scanner ); var instance = kernel.Get<IDefaultConvention>(); Assert.NotNull( instance ); Assert.Equal( typeof (DefaultConvention), instance.GetType() ); } }
public void OpenGenericsAreFound() { IKernel kernel = new StandardKernel(); kernel.Scan( x => { x.CallingAssembly(); x.Using( new GenericBindingGenerator( typeof (IGenericView<>) ) ); } ); object target = kernel.Get<IGenericView<IDefaultConvention>>(); Assert.IsAssignableFrom<DefaultConventionView>( target ); target = kernel.Get<IGenericView<string>>(); Assert.IsAssignableFrom<StringView>( target ); }
public void TestBindingGeneratorInLambaSyntax() { using ( IKernel kernel = new StandardKernel() ) { kernel.Scan( x => { x.Assembly( Assembly.GetExecutingAssembly() ); x.Using<DefaultBindingGenerator>(); } ); var instance = kernel.Get<IDefaultConvention>(); Assert.NotNull( instance ); Assert.Equal( typeof (DefaultConvention), instance.GetType() ); } }