Exemple #1
0
        private static ISiteCatalogService MakeTestsService(bool useAutoFac, ref MockDependents mockDependents)
        {
            if (useAutoFac)
            {
                ContainerBuilder cb = GetTestsContainer();

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

                IContainer testcontainer = cb.Build();

                return(testcontainer.Resolve <ISiteCatalogService>());
            }
            mockDependents = new MockDependents();
            mockDependents.ICatalogLogic                  = MockDependents.MakeMockICatalogLogic();
            mockDependents.ICatalogRepository             = MockDependents.MakeMockICatalogRepository();
            mockDependents.IPriceLogic                    = MockDependents.MakeMockIPriceLogic();
            mockDependents.IHistoryListLogic              = MockDependents.MakeMockIHistoryListLogic();
            mockDependents.ICategoryImageRepository       = MockDependents.MakeMockICategoryImageRepository();
            mockDependents.IRecommendedItemsRepository    = MockDependents.MakeMockIRecommendedItemsRepository();
            mockDependents.IGrowthAndRecoveriesRepository = MockDependents.MakeMockIGrowthAndRecoveriesRepository();

            ISiteCatalogService testunit = new SiteCatalogServiceImpl(mockDependents.ICatalogLogic.Object, mockDependents.ICatalogRepository.Object,
                                                                      mockDependents.IPriceLogic.Object, mockDependents.IHistoryListLogic.Object,
                                                                      mockDependents.ICategoryImageRepository.Object,
                                                                      mockDependents.IRecommendedItemsRepository.Object,
                                                                      mockDependents.IGrowthAndRecoveriesRepository.Object);

            return(testunit);
        }