Example #1
0
        public void AddToCoinInventory_ShouldWork()
        {
            MockDataAccess   da    = new MockDataAccess();
            SodaMachineLogic logic = new SodaMachineLogic(da);

            List <CoinModel> coins = new List <CoinModel>
            {
                new CoinModel {
                    Name = "Quarter", Amount = 0.25M
                },
                new CoinModel {
                    Name = "Quarter", Amount = 0.25M
                },
                new CoinModel {
                    Name = "Dime", Amount = 0.1M
                }
            };

            logic.AddToCoinInventory(coins);

            int expected = 6;
            int actual   = da.CoinInventory.Where(x => x.Name == "Quarter").Count();

            Assert.Equal(expected, actual);
        }
Example #2
0
        public void AddToCoinInventory_ShouldWork()
        {
            // Arrange
            int expectedCount;
            int actualCount;
            List <CoinModel> coins = new List <CoinModel>()
            {
                new CoinModel {
                    Name = "Quarter", Amount = 0.25M
                },
                new CoinModel {
                    Name = "Dollar", Amount = 1.00M
                }
            };

            // Act
            expectedCount = 2 + mockDataAccess.CoinInventory.Count;
            sodaMachineLogic.AddToCoinInventory(coins);
            actualCount = mockDataAccess.CoinInventory.Count;

            // Assert
            Assert.AreEqual(expectedCount, actualCount);
        }