コード例 #1
0
        public void Setup()
        {
            var giftVoucherValueValidator       = new GiftVoucherValueValidator();
            var giftVouchersNotInTotalValidator = new GiftVouchersNotInTotalValidator(giftVoucherValueValidator);

            _giftvalidator = new GiftVoucherValidatorAdaptor(giftVouchersNotInTotalValidator);

            var offerSingleValidator           = new SingleOfferVoucherValidator();
            var offerVoucherThresholdValidator = new OfferVoucherThresholdValidator(offerSingleValidator);
            var offerRestrictionValidator      = new OfferVoucherRestrictionValidator(offerVoucherThresholdValidator);

            _offerValidator = new OfferVoucherValidatorAdaptor(offerRestrictionValidator);

            _basket = new Basket(new List <IVoucherValidator> {
                _giftvalidator, _offerValidator
            });
        }
コード例 #2
0
ファイル: Basket.cs プロジェクト: Nosmadas/Basket
 public Basket(IVoucherValidator voucherValidator, IValueCalculator valueCalculator)
 {
     _voucherValidator = voucherValidator ?? throw new ArgumentNullException(nameof(voucherValidator));
     _valueCalculator  = valueCalculator ?? throw new ArgumentNullException(nameof(valueCalculator));
 }