Example #1
0
        public void ExportInterfaceWithTypeOf2()
        {
            var builder = new ConventionBuilder();

            builder.ForType(typeof(FooImpl)).Export((c) => c.AsContractType(typeof(IFoo)));

            Collections.Generic.IEnumerable <ExportAttribute> exports = builder.GetDeclaredAttributes(typeof(FooImpl), typeof(FooImpl).GetTypeInfo()).Where <Attribute>(e => e is ExportAttribute).Cast <ExportAttribute>();
            Assert.Equal(1, exports.Count());
            Assert.Equal(exports.First().ContractType, typeof(IFoo));
        }
Example #2
0
        public void ExportInterfaceWithTypeOf1()
        {
            var builder = new ConventionBuilder();

            builder.ForType <FooImpl>().Export <IFoo>();

            Collections.Generic.IEnumerable <ExportAttribute> exports = builder.GetCustomAttributes(typeof(FooImpl), typeof(FooImpl).GetTypeInfo()).Where <Attribute>(e => e is ExportAttribute).Cast <ExportAttribute>();
            Assert.Equal(1, exports.Count());
            Assert.Equal(typeof(IFoo), exports.First().ContractType);
        }