public void InstanceTypeLifeCycle() { IContainer container = new IocContainer.Container(); // testing instance type resigtration for class container.RegisterInstanceType <ITest2, ClassTest2>(); ITest2 obj1 = container.Resolve <ITest2>(); container.RegisterInstanceType <ITest2, ClassTest2>(); ITest2 obj2 = container.Resolve <ITest2>(); Assert.NotEqual(obj2.Hash(), obj1.Hash()); }
public void SingletonLifeCycle() { IContainer container = new IocContainer.Container(); container.RegisterSingletonType <ITest2, ClassTest2>(); ITest2 obj1 = container.Resolve <ITest2>(); container.RegisterSingletonType <ITest2, ClassTest2>(); ITest2 obj2 = container.Resolve <ITest2>(); Assert.Equal(obj2.Hash(), obj1.Hash()); }