示例#1
0
        public SolutionService(ICacheManager cacheManager, IRepository<Solution> solRepository, IEventPublisher eventPublisher,
            ISolutionBPCalculationService solBPCalService, IProductType1ConfigService proType1ConfigService,
            ISolutionFunderFeatureService solFunFeaService, ISolutionFeatureConfigService solFeaConfigService,
            ISolutionFunderService solFunService)
        {
            this._cacheManager = cacheManager;
            this._solRepository = solRepository;
            this._eventPublisher = eventPublisher;

            this._solBPCalService = solBPCalService;
            this._proType1ConfigService = proType1ConfigService;

            this._solFunFeaService = solFunFeaService;
            this._solFeaConfigService = solFeaConfigService;
            this._solFunService = solFunService;
        }
        public void Setup()
        {
            _cacheManger = new NopNullCache();
            _eventPublisher = MockRepository.GenerateMock<IEventPublisher>();
            _solFunRepository = MockRepository.GenerateMock<IRepository<SolutionFunder>>();

            var solfun1 = new SolutionFunder() { Id = 1, SolutionID = 1, SupplierID = 1 };
            var solfun2 = new SolutionFunder() { Id = 2, SolutionID = 2, SupplierID = 1 };
            var solfun3 = new SolutionFunder() { Id = 3, SolutionID = 1, SupplierID = 2 };
            var solfun4 = new SolutionFunder() { Id = 4, SolutionID = 2, SupplierID = 2 };
            var solfun5 = new SolutionFunder() { Id = 5, SolutionID = 3, SupplierID = 2 };
            var solfun6 = new SolutionFunder() { Id = 6, SolutionID = 4, SupplierID = 3 };

            _solFunRepository.Expect(s => s.Table).Return(new List<SolutionFunder> { solfun1, solfun2, solfun3, solfun4, solfun5, solfun6 }.AsQueryable());
            _solFunRepository.Expect(s => s.TableNoTracking).Return(new List<SolutionFunder> { solfun1, solfun2, solfun3, solfun4, solfun5, solfun6 }.AsQueryable());

            _solutionFunderService = new SolutionFunderService(_cacheManger, _solFunRepository, _eventPublisher);
        }