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);
        }
Exemplo n.º 2
0
 private static void CheckCurrencies(Amount lhs, Amount rhs)
 {
     if (lhs.currency != rhs.currency)
     throw new Exception("incompatible currencies");
 }
Exemplo n.º 3
0
 protected bool Equals(Amount other)
 {
     return amount.Equals(other.amount) && currency == other.currency;
 }
Exemplo n.º 4
0
 public Price(Amount basePrice, Amount tax)
 {
     BasePrice = basePrice;
       Tax = tax;
 }
 public StrategyExercise()
 {
     total = new Amount(Currency.DKK, 100);
 }