public void TestType() { var container = new CryoContainer(); container.RegisterType <MyClazz>(); Assert.IsNull(container.TryResolve <MyClazz>()); var clazz = container.Resolve <MyClazz>(); Assert.IsNotNull(clazz); Assert.IsNull(container.TryResolve <MyClazz>()); }
public void TestSingleton() { var container = new CryoContainer(); container.RegisterSingleton <MyClazz>(); Assert.IsNull(container.TryResolve <MyClazz>()); var clazz = container.Resolve <MyClazz>(); Assert.IsNotNull(clazz); var clazz2 = container.TryResolve <MyClazz>(); Assert.IsNotNull(clazz2); Assert.AreSame(clazz, clazz2); }
public void TestInstance() { var container = new CryoContainer(); var myClazz = new MyClazz(); container.RegisterInstance(myClazz); var myClazz2 = container.TryResolve <MyClazz>(); Assert.IsNotNull(myClazz2); Assert.AreSame(myClazz, myClazz2); }