public void Initialize() { _uow = A.Fake<IUnitOfWork>(); _mapper = A.Fake<IMappingEngine>(); _service = new PromotionService(_uow, _mapper); _nonExistingPromotion = new Promotion(); _existingPromotion = new Promotion(); _promotionWithNoPayments = new Promotion(); _promotionWithPayments = new Promotion(); _nonExistingPromotionDTO = new PromotionDTO(); _existingPromotionDTO = new PromotionDTO(); _promotionWithNoPaymentsDTO = new PromotionDTO(); _promotionWithPaymentsDTO = new PromotionDTO(); A.CallTo(() => _mapper.Map<Promotion>(_nonExistingPromotionDTO)).Returns(_nonExistingPromotion); A.CallTo(() => _mapper.Map<Promotion>(_existingPromotionDTO)).Returns(_existingPromotion); A.CallTo(() => _mapper.Map<Promotion>(_promotionWithNoPaymentsDTO)).Returns(_promotionWithNoPayments); A.CallTo(() => _mapper.Map<Promotion>(_promotionWithPaymentsDTO)).Returns(_promotionWithPayments); A.CallTo(() => _uow.PromotionRepository.IsExisting(_nonExistingPromotion)).Returns(false); A.CallTo(() => _uow.PromotionRepository.IsExisting(_existingPromotion)).Returns(true); A.CallTo(() => _uow.PromotionRepository.HasPayments(_promotionWithPayments)).Returns(true); A.CallTo(() => _uow.PromotionRepository.HasPayments(_promotionWithNoPayments)).Returns(false); }
public PromotionsController(PromotionService service) { _service = service; }