Beispiel #1
0
        public void SubtractDollarAmountTest()
        {
            DollarAmount thisDollarAmount       = new DollarAmount(333);
            DollarAmount dollarAmountToSubtract = new DollarAmount(111);
            DollarAmount subtractedAmount       = thisDollarAmount.Minus(dollarAmountToSubtract);

            Assert.AreEqual(222, (subtractedAmount.Dollars * 100) + subtractedAmount.Cents);
        }
        public void MinusTest()
        {
            DollarAmount thisTest   = new DollarAmount(90);
            DollarAmount addingTest = new DollarAmount(10);
            DollarAmount answer     = new DollarAmount(80);
            DollarAmount result     = thisTest.Minus(addingTest);

            Assert.AreEqual(answer.Dollars, result.Dollars);
            Assert.AreEqual(answer.Cents, result.Cents);
        }
        public void MinusTest()
        {
            DollarAmount minusTest         = new DollarAmount(150);
            DollarAmount amountToSubtract  = new DollarAmount(100);
            DollarAmount minusTest1        = new DollarAmount(1000);
            DollarAmount amountToSubtract2 = new DollarAmount(1000);
            DollarAmount minusTest2        = new DollarAmount(230);
            DollarAmount amountToSubtract3 = new DollarAmount(200);

            Assert.AreEqual(50, minusTest.Minus(amountToSubtract).TotalAmountInCents);
            Assert.AreEqual(0, minusTest1.Minus(amountToSubtract2).TotalAmountInCents);
            Assert.AreEqual(30, minusTest2.Minus(amountToSubtract3).TotalAmountInCents);
        }