public void InsideTheLambdaCallGetCustomAttributesShouldSucceed()
        {
            var builder = new ConventionBuilder();

            builder.ForTypesMatching((t) => !t.GetTypeInfo().IsDefined(typeof(MyDoNotIncludeAttribute), false)).Export();
            var container = new ContainerConfiguration()
                            .WithPart <MyNotToBeIncludedClass>(builder)
                            .WithPart <MyToBeIncludedClass>(builder)
                            .CreateContainer();

            var importer = new ImporterOfMyNotTobeIncludedClass();

            container.SatisfyImports(importer);

            Assert.Null(importer.MyNotToBeIncludedClass);
            Assert.NotNull(importer.MyToBeIncludedClass);
        }
Exemple #2
0
        public void InsideTheLambdaCallGetCustomAttributesShouldSucceed()
        {
            //Same test as above only using default export builder
            var builder = new RegistrationBuilder();

            builder.ForTypesMatching((t) => !t.IsDefined(typeof(MyDoNotIncludeAttribute), false)).Export();

            var types   = new Type[] { typeof(MyNotToBeIncludedClass), typeof(MyToBeIncludedClass) };
            var catalog = new TypeCatalog(types, builder);

            var cs       = catalog.CreateCompositionService();
            var importer = new ImporterOfMyNotTobeIncludedClass();

            cs.SatisfyImportsOnce(importer);

            Assert.IsNull(importer.MyNotToBeIncludedClass);
            Assert.IsNotNull(importer.MyToBeIncludedClass);
        }
        public void InsideTheLambdaCallGetCustomAttributesShouldSucceed()
        {
            var builder = new ConventionBuilder();
            builder.ForTypesMatching((t) => !t.GetTypeInfo().IsDefined(typeof(MyDoNotIncludeAttribute), false)).Export();
            var container = new ContainerConfiguration()
                .WithPart<MyNotToBeIncludedClass>(builder)
                .WithPart<MyToBeIncludedClass>(builder)
                .CreateContainer();

            var importer = new ImporterOfMyNotTobeIncludedClass();
            container.SatisfyImports(importer);

            Assert.Null(importer.MyNotToBeIncludedClass);
            Assert.NotNull(importer.MyToBeIncludedClass);
        }