Exemplo n.º 1
0
        public void MoneyConstructionSetsPluralNameWithZeroCount()
        {
            string expected = "tests";
            Money  money    = new MoneyTestMoney(0.01m, "test", "tests");

            Assert.Equal(expected, money.Name);
        }
Exemplo n.º 2
0
        public void MoneyConstructionSetsSingularNameAccurately()
        {
            string expected = "test";
            Money  money    = new MoneyTestMoney(0.01m, "test", "tests", 1);

            Assert.Equal(expected, money.Name);
        }
Exemplo n.º 3
0
        public void MoneyConstructionSetsDenominationAccurately()
        {
            decimal expected = 0.01m;
            Money   money    = new MoneyTestMoney(0.01m, "test", "tests", 3);

            Assert.Equal(expected, money.Denomination);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }