public void DefaultConstructorTest() { var container = new GeckoContainer(); container.RegisterSingletone <Test1>(); var actual = container.BuildUpType <Test1>(); Assert.IsNotNull(actual); }
public void MethodInjectionTest() { var container = new GeckoContainer(); var injection1 = new Test1(); container.RegisterInstance(injection1); var actual = container.BuildUpType <Test2>(); Assert.IsNotNull(actual); Assert.AreEqual(injection1, actual.Test1); }
public void TestInjectInInheritedConstructor() { var container = new GeckoContainer(); var test1 = new Test1(); container.RegisterInstance(test1); var child = container.BuildUpType <ChildTest>(); Assert.IsNotNull(child); Assert.AreEqual(test1, child.Test1); }
public void ConstructorWithDependencyAttributeInjectionTest() { var container = new GeckoContainer(); var injection = new Test1(); container.RegisterInstance(injection); container.RegisterSingletone <Test2>(); var actual = container.BuildUpType <Test3>(); Assert.IsNotNull(actual); Assert.AreEqual(injection, actual.Test1); Assert.IsNotNull(actual.Test2); }
public void ConstructorInjectionTest() { var container = new GeckoContainer(); var injection0 = new Test1(); var injection1 = new Test1(); container.RegisterInstance(injection0).WithName("Test0"); container.RegisterInstance(injection1).WithName("Test1"); var actual = container.BuildUpType <Test2>(); Assert.IsNotNull(actual); Assert.AreEqual(injection0, actual.Test0); Assert.AreEqual(injection1, actual.Test1); }
public void ParameterMethodInjectionTest() { var container = new GeckoContainer(); var param1 = new Test1(); var param2 = new Test1(); var actual = container.BuildUpType <Test2>( new Parameter(param1, "TestParam1"), new Parameter(param2, "TestParam2")); Assert.IsNotNull(actual); Assert.AreEqual(param1, actual.TestParam1); Assert.AreEqual(param2, actual.TestParam2); Assert.AreNotEqual(actual.TestParam1, actual.TestParam2); }
public void ConstructorParameterOverProviderInjection() { var container = new GeckoContainer(); var test1Param = new Test1(); var test1Provider = new Test1(); container.RegisterInstance(test1Provider); var test2 = container.BuildUpType <Test2>(new Parameter(test1Param)); Assert.NotNull(test2); Assert.AreEqual(test1Param, test2.Test1); Assert.AreNotEqual(test1Provider, test2.Test1); }