コード例 #1
0
        public void TestGetObjectsInheritingFromSuperClassFromContainer()
        {
            var container = new DependencyInjector(new ServiceConfiguration(), new MoreConfig());
            container.ExpandConfiguration(new ComplexConfig());
            container.Reconfigure();
            Assert.IsTrue(container.ContainsObject<ISomeDomainCmdService>());
            Assert.IsTrue(container.ContainsObject<ICommandManager>());
            Assert.IsTrue(container.ContainsObject("SomeDomainCmdServiceB"));
            Assert.IsTrue(container.ContainsObject<IAggregate>());

            List<ISomeDomainCmdService> someDomainCmdServices = container.GetAllObjectsInheriting<ISomeDomainCmdService>();
            Assert.AreEqual(2, someDomainCmdServices.Count);

            List<SomeDomainCmdServiceC> someDomainCmdServicesC = container.GetAllObjectsInheriting<SomeDomainCmdServiceC>();
            Assert.AreEqual(0, someDomainCmdServicesC.Count);
        }
コード例 #2
0
        public void TestGetObjectsInheritingFromPrototypeSuperClassFromContainer()
        {
            var container = new DependencyInjector(new ServiceConfiguration(), new MoreConfig());
            container.ExpandConfiguration(new ComplexConfig());
            container.Reconfigure();

            List<Prototype> prototypes = container.GetAllObjectsInheriting<Prototype>();
            Assert.AreEqual(1, prototypes.Count);
        }