Пример #1
0
        private static IReportLogic MakeTestsLogic(bool useAutoFac, ref MockDependents mockDependents)
        {
            if (useAutoFac)
            {
                ContainerBuilder cb = GetTestsContainer();

                // Register mocks
                MockDependents.RegisterInContainer(ref cb);

                IContainer testcontainer = cb.Build();

                return(testcontainer.Resolve <IReportLogic>());
            }
            mockDependents = new MockDependents();
            mockDependents.ICatalogLogic       = MockDependents.MakeICatalogLogic();
            mockDependents.ICatalogRepository  = MockDependents.MakeICatalogRepository();
            mockDependents.IReportRepository   = MockDependents.MakeIReportRepository();
            mockDependents.IEventLogRepository = MockDependents.MakeIEventLogRepository();

            ReportLogic testunit = new ReportLogic(mockDependents.ICatalogRepository.Object, mockDependents.IReportRepository.Object, mockDependents.IEventLogRepository.Object,
                                                   mockDependents.ICatalogLogic.Object);

            return(testunit);
        }