public void add_tax_to_total()
        {
            // arrange
              var tax = new Amount(Currency.DKK, 25);
              var expected = new Price(total, tax);
              var fakeTaxStrategy = A.Fake<TaxCalculationStrategy>();
              A.CallTo(fakeTaxStrategy).WithReturnType<Amount>().Returns(tax);

              var sut = new PriceCalculator(fakeTaxStrategy);
              var order = CreateOrder(sut, 25, isConsumer: true);

              // act
              var actual = order.CreateBill().Price;

              // assert
              Assert.Equal(expected, actual);
        }
 private static void CheckCurrencies(Amount lhs, Amount rhs)
 {
     if (lhs.currency != rhs.currency)
     throw new Exception("incompatible currencies");
 }
 protected bool Equals(Amount other)
 {
     return amount.Equals(other.amount) && currency == other.currency;
 }
Esempio n. 4
0
 public Price(Amount basePrice, Amount tax)
 {
     BasePrice = basePrice;
       Tax = tax;
 }
 public StrategyExercise()
 {
     total = new Amount(Currency.DKK, 100);
 }