コード例 #1
0
        /// <summary>
        /// Creates bindings using conventions
        /// </summary>
        /// <param name="kernel">The kernel for which the bindings are created.</param>
        /// <param name="configure">The binding convention configuration.</param>
        public static void Bind(this IBindingRoot kernel, Action<IFromSyntax> configure)
        {
            if (configure == null)
            {
                throw new ArgumentNullException("configure");
            } 

#if !NO_ASSEMBLY_SCANNING
            var assemblyNameRetriever = new AssemblyNameRetriever();
            try
            {
                var builder = new ConventionSyntax(
                    new ConventionBindingBuilder(kernel, new TypeSelector()),
                    new AssemblyFinder(assemblyNameRetriever),
                    new TypeFilter(),
                    new BindingGeneratorFactory(new BindableTypeSelector()));
                configure(builder);
            }
            finally
            {
                assemblyNameRetriever.Dispose();                
            }
#else
            var builder = new ConventionSyntax(
                new ConventionBindingBuilder(kernel, new TypeSelector()), 
                new TypeFilter(), 
                new BindingGeneratorFactory(new BindableTypeSelector()));
            configure(builder);
#endif
        }
コード例 #2
0
        public ConventionSyntaxFilteringTests()
        {
            this.conventionBindingBuilderMock = new Mock <IConventionBindingBuilder>();
#if !NO_ASSEMBLY_SCANNING
            this.testee = new ConventionSyntax(this.conventionBindingBuilderMock.Object, null, null, null);
#else
            this.testee = new ConventionSyntax(this.conventionBindingBuilderMock.Object, null, null);
#endif
        }
        public ConventionSyntaxSelectTests()
        {
            this.conventionBindingBuilderMock = new Mock<IConventionBindingBuilder>();
            this.typeFilterMock = new Mock<ITypeFilter>();
#if !NO_ASSEMBLY_SCANNING
            this.testee = new ConventionSyntax(this.conventionBindingBuilderMock.Object, null, this.typeFilterMock.Object, null);
#else
            this.testee = new ConventionSyntax(this.conventionBindingBuilderMock.Object, this.typeFilterMock.Object, null);
#endif
        }
        public ConventionSyntaxBindingTests()
        {
            this.conventionBindingBuilderMock = new Mock<IConventionBindingBuilder>();
            this.bindingGeneratorFactoryMock = new Mock<IBindingGeneratorFactory>();
#if !NO_ASSEMBLY_SCANNING
            this.testee = new ConventionSyntax(this.conventionBindingBuilderMock.Object, null, null, this.bindingGeneratorFactoryMock.Object);
#else
            this.testee = new ConventionSyntax(this.conventionBindingBuilderMock.Object, null, this.bindingGeneratorFactoryMock.Object);
#endif
            }       
コード例 #5
0
        public ConventionSyntaxBindingTests()
        {
            this.conventionBindingBuilderMock = new Mock <IConventionBindingBuilder>();
            this.bindingGeneratorFactoryMock  = new Mock <IBindingGeneratorFactory>();
#if !NO_ASSEMBLY_SCANNING
            this.testee = new ConventionSyntax(this.conventionBindingBuilderMock.Object, null, null, this.bindingGeneratorFactoryMock.Object);
#else
            this.testee = new ConventionSyntax(this.conventionBindingBuilderMock.Object, null, this.bindingGeneratorFactoryMock.Object);
#endif
        }
コード例 #6
0
        public ConventionSyntaxFromTests()
        {
            this.conventionBindingBuilderMock = new Mock <IConventionBindingBuilder>();
#if !NO_ASSEMBLY_SCANNING
            this.assemblyFinderMock = new Mock <IAssemblyFinder>();
            this.testee             = new ConventionSyntax(this.conventionBindingBuilderMock.Object, this.assemblyFinderMock.Object, null, null);
#else
            this.testee = new ConventionSyntax(this.conventionBindingBuilderMock.Object, null, null);
#endif
        }