Exemple #1
0
        public void Substruct_ValidNumber_Substructs(int val)
        {
            var c = new CoinsPile(1, 5);

            c.Substruct((uint)val);
            Assert.AreEqual(5 - val, c.Count);
        }
Exemple #2
0
        public void Add_ValidNumber_Adds()
        {
            var c = new CoinsPile(1);

            c.Add(3);
            Assert.AreEqual(3, c.Count);
        }
Exemple #3
0
        public void TakeCoins_SmallBalance_SetsCoinsToValidCountAndBalanceToZero()
        {
            uint bal = 30;

            var p      = new CoinsPile(2, 20);
            var result = p.TakeCoins(ref bal);

            Assert.AreEqual(5, p.Count);
            Assert.AreEqual(2, result.Nominal);
            Assert.AreEqual(15, result.Count);
            Assert.AreEqual(0, bal);
        }
Exemple #4
0
        public void TakeCoins_BigBalance_SetsCoinsToZeroAndModifiesBalance()
        {
            uint bal = 100;

            var p      = new CoinsPile(3, 32);
            var result = p.TakeCoins(ref bal);

            Assert.AreEqual(0, p.Count);
            Assert.AreEqual(3, result.Nominal);
            Assert.AreEqual(32, result.Count);
            Assert.AreEqual(4, bal);
        }
        public void TakeCoins_SmallBalance_SetsCoinsToValidCountAndBalanceToZero()
        {
            uint bal = 30;

            var p = new CoinsPile(2, 20);
            var result = p.TakeCoins(ref bal);

            Assert.AreEqual(5, p.Count);
            Assert.AreEqual(2, result.Nominal);
            Assert.AreEqual(15, result.Count);
            Assert.AreEqual(0, bal);
        }
        public void TakeCoins_BigBalance_SetsCoinsToZeroAndModifiesBalance()
        {
            uint bal = 100;

            var p = new CoinsPile(3, 32);
            var result = p.TakeCoins(ref bal);

            Assert.AreEqual(0, p.Count);
            Assert.AreEqual(3, result.Nominal);
            Assert.AreEqual(32, result.Count);
            Assert.AreEqual(4, bal);
        }
 public void Substruct_ValidNumber_Substructs(int val)
 {
     var c = new CoinsPile(1, 5);
     c.Substruct((uint)val);
     Assert.AreEqual(5 - val, c.Count);
 }
 public void Add_ValidNumber_Adds()
 {
     var c = new CoinsPile(1);
     c.Add(3);
     Assert.AreEqual(3, c.Count);
 }
Exemple #9
0
 public CoinsPileViewItem(CoinsPile source)
 {
     this.Source = source;
 }
 public CoinsPileEventArgs(CoinsPile pile)
 {
     this.Pile = pile;
 }