Ejemplo n.º 1
0
        public void RegistCustomerMethodTest()
        {
            var factory = Factory.GetInst();
            factory.RegistCustomerGetFunc(p => p == typeof(Animal), q => new Dog(), IOCFactoryModel.Enum.CustomerMethodEffectEnum.Once);

            var exp = new Dog();
            var inst = factory.Get<Animal>();

            Assert.AreEqual(exp.Hawl(), inst.Hawl());
        }
Ejemplo n.º 2
0
 public void NormalInstTest()
 {
     Factory factory = Factory.GetInst();
     var result = new Dog();
     var dog = factory.Get<Animal>("dog");
     Assert.AreEqual(dog.Hawl(), result.Hawl());
     var cat = factory.Get<Animal>("cat");
     Assert.AreNotEqual(cat.Hawl(), result.Hawl());
 }