public void DryIoc() { var container = new DryIoc.Container(); foreach (var type in _types) { container.Register(type, type); } int length = 0; if (Scenario == ResolveScenario.ResolveOne) { length = 1; } else if (Scenario == ResolveScenario.ResolveHalf) { length = _types.Length / 2; } else if (Scenario == ResolveScenario.ResolveAll) { length = _types.Length; } for (var i = 0; i < length; i++) { container.Resolve(_types[i]); } container.Dispose(); }
public override TestResult DoTest(ITestCase testCase, int testCasesNumber, bool singleton) { var result = new TestResult { Singleton = singleton, TestCasesNumber = testCasesNumber }; var sw = new Stopwatch(); var c = new Container(); if (singleton) { sw.Start(); c = (Container)testCase.SingletonRegister(c); sw.Stop(); } else { sw.Start(); c = (Container)testCase.TransientRegister(c); sw.Stop(); } result.RegisterTime = sw.ElapsedMilliseconds; sw.Reset(); result.ResolveTime = DoResolve(sw, testCase, c, testCasesNumber, singleton); c.Dispose(); return result; }
public void Dispose() => _container.Dispose();