Exemple #1
0
        public void openGenericAndExplicit()
        {
            var builder = new Konstruktor();

            builder.mapInterfaceToImplementation(typeof(IOG <>), typeof(OG <>));
            builder.mapInterfaceToImplementation(typeof(IOG <int>), typeof(ExplicitInt));

            using (var scope = builder.beginScope())
            {
                var fl = scope.resolve <IOG <float> >();
                var i  = scope.resolve <IOG <int> >();

                Assert.AreEqual(typeof(OG <float>), fl.GetType());
                Assert.AreEqual(typeof(ExplicitInt), i.GetType());
            }
        }
Exemple #2
0
        public void openGeneric()
        {
            var builder = new Konstruktor();

            builder.mapInterfaceToImplementation(typeof(IShared <>), typeof(Shared <>));

            using (var scope = builder.beginScope())
            {
                var shared = scope.resolve <IShared <int> >();
                Assert.AreEqual(typeof(Shared <int>), shared.GetType());
            }
        }