Пример #1
0
        public void MoneyConstructionSetsPluralNameWithZeroCount()
        {
            string expected = "tests";
            Money  money    = new MoneyTestMoney(0.01m, "test", "tests");

            Assert.Equal(expected, money.Name);
        }
Пример #2
0
        public void MoneyConstructionSetsSingularNameAccurately()
        {
            string expected = "test";
            Money  money    = new MoneyTestMoney(0.01m, "test", "tests", 1);

            Assert.Equal(expected, money.Name);
        }
Пример #3
0
        public void MoneyConstructionSetsDenominationAccurately()
        {
            decimal expected = 0.01m;
            Money   money    = new MoneyTestMoney(0.01m, "test", "tests", 3);

            Assert.Equal(expected, money.Denomination);
        }
Пример #4
0
        public void MoneyClearsCount()
        {
            Money money = new MoneyTestMoney(1, "test", "tests", 5);

            Assert.Equal(5, money.Count);

            money.Clear();
            Assert.Equal(0, money.Count);
        }
Пример #5
0
        public void MoneySubtractsCorrectAmount()
        {
            Money money = new MoneyTestMoney(1, "test", "tests", 5);

            Assert.Equal(5, money.Count);

            money.Subtract(1);
            Assert.Equal(4, money.Count);

            money.Subtract(-1);
            Assert.Equal(5, money.Count);
        }
Пример #6
0
        public void MoneyAddsCorrectAmount()
        {
            Money money = new MoneyTestMoney(1, "test", "tests");

            Assert.Equal(0, money.Count);

            money.Add(1);
            Assert.Equal(1, money.Count);

            money.Add(-1);
            Assert.Equal(0, money.Count);
        }