コード例 #1
0
        public void TestImplementedBy()
        {
            context.ScannedPackages = new string[] {
                "strange.unittests.annotated.testImplBy"                 //Namespace is the only true difference. Same tests as above for the same action done by a different method
            };
            context.Start();

            TestInterface testImpl = context.injectionBinder.GetInstance <TestInterface>() as TestInterface;

            Assert.IsNotNull(testImpl);
            Assert.IsTrue(typeof(TestInterface).IsAssignableFrom(testImpl.GetType())); //Check that this objects type implements test interface.
            Assert.AreEqual(testImpl.GetType(), typeof(TestImpl));                     //Check that its the type we added below
        }
コード例 #2
0
        public void TestImplementsToInterface()
        {
            context.ScannedPackages = new string[] {
                "strange.unittests.annotated.testImplements"
            };
            context.Start();

            TestInterface testImpl = context.injectionBinder.GetInstance <TestInterface>() as TestInterface;

            Assert.IsNotNull(testImpl);
            Assert.IsTrue(typeof(TestInterface).IsAssignableFrom(testImpl.GetType())); //Check that this objects type implements test interface.
            Assert.AreEqual(testImpl.GetType(), typeof(TestImpl));                     //Check that its the type we added below
        }