private static IDivisionLogic MakeTestsLogic(bool useAutoFac, ref MockDependents mockDependents) { if (useAutoFac) { ContainerBuilder cb = GetTestsContainer(); // Register mocks MockDependents.RegisterInContainer(ref cb); var testcontainer = cb.Build(); return(testcontainer.Resolve <IDivisionLogic>()); } else { mockDependents = new MockDependents(); mockDependents.DivisionRepository = MockDependents.MakeDivisionRepositoryMock(); mockDependents.BranchSupportRepository = MockDependents.MakeBranchSupportRepositoryMock(); var testunit = new DivisionLogicImpl(mockDependents.DivisionRepository.Object, mockDependents.BranchSupportRepository.Object); return(testunit); } }