//TODO использовать для провайдеров public void BuildUp(params Parameter[] parameters) { if (BuiltUp) { return; } BuiltUp = true; TryGetRootContainer(); _rootContainer.BuildUp(this, parameters); }
public void TestResolveProtectedDependency() { var container = new GeckoContainer(); var test1 = new Test1(); container.RegisterInstance(test1); var test2 = new TestProtectedDep(); container.BuildUp(test2); Assert.AreEqual(test1, test2.GetTestDep()); }
public void TestResolveInheritedDependency() { var container = new GeckoContainer(); var test = new Test(); container.RegisterInstance(test); var testChild = new TestChild(); container.BuildUp(testChild); Assert.AreEqual(test, testChild.TestDep); }
public void TestResolveInternalDependency() { var container = new GeckoContainer(); var test1 = new Test1(); container.RegisterInstance(test1); var test2 = new TestInternalDep(); container.BuildUp(test2); Assert.AreEqual(test1, test2.Test1); }
public void ParameterBuildUpTest() { var container = new GeckoContainer(); var test2 = new Test2(); var test1_1 = new Test1(); var test1_2 = new Test1(); container.BuildUp(test2, new Parameter(test1_1, "1"), new Parameter(test1_2, "2")); Assert.AreEqual(test1_1, test2.Test1_1); Assert.AreEqual(test1_2, test2.Test1_2); }
public void TestResolveNamedDependency() { var container = new GeckoContainer(); var test1 = new Test1(); var test2 = new Test1(); container.RegisterInstance(test1).WithName("Test1"); container.RegisterInstance(test2).WithName("test1"); var testNamedDep = new TestNamedDep(); container.BuildUp(testNamedDep); Assert.AreEqual(test1, testNamedDep.Test1); Assert.AreEqual(test2, testNamedDep.Test2); }