public void ContainerRegisterInstanceAsInterfaceTest() { var container = new GeckoContainer(); var testClass = new TestClass(); container.RegisterInstance(testClass).As <ITest>(); Assert.IsTrue(container.IsKeyRegistered <TestClass>()); Assert.IsTrue(container.IsKeyRegistered <ITest>()); var actual = container.Resolve <ITest>(); Assert.AreEqual(testClass, actual); }
public void ContainerRegisterInstanceWithNameTest() { var container = new GeckoContainer(); var testClass = new TestClass(); container.RegisterInstance(testClass).WithName(TestName); Assert.IsFalse(container.IsKeyRegistered <TestClass>()); Assert.IsTrue(container.IsKeyRegistered <TestClass>(TestName)); var actual = container.Resolve <TestClass>(TestName); Assert.AreEqual(testClass, actual); }