Example #1
0
        public decimal GetTax(ISalesTaxStrategy salesTaxStrategy = default)
        {
            var strategy = salesTaxStrategy ?? this.SalesTaxStrategy;

            if (strategy == null)
            {
                throw new NullReferenceException($"{nameof(SalesTaxStrategy)} is not provided");
            }

            return(strategy.GetTax(this));
        }
Example #2
0
        public decimal GetTax(ISalesTaxStrategy salesTaxStrategy = default)
        {
            var strategy = salesTaxStrategy ?? SalesTaxStrategy;

            if (SalesTaxStrategy == null)
            {
                return(0m);
            }

            return(strategy.GetTaxFor(this));
        }
Example #3
0
        //public Order(ISalesTaxStrategy context)
        //{
        //    _taxcontext = context;
        //}

        public void SetContext(ISalesTaxStrategy taxcontext)
        {
            this._taxcontext = taxcontext;
        }