public void Initalize()
        {
            _factory = new MockRepository(MockBehavior.Loose);
            _container = new AutoMockContainer(_factory);
            _coins = new List<Coin>();
            _purchaseServiceMock = _container.GetMock<IPurchaseService>();

            var product_a = new Product() { Price = 1, Title = "Apple" };
            var product_b = new Product() { Price = .75m, Title = "Banana" };

            var slot_a = new Slot() { Button = "A", Product = product_a, MaxNumberOfProduct = 5, Quantity = 4 };
            var slot_b = new Slot() { Button = "B", Product = product_b, MaxNumberOfProduct = 5, Quantity = 0 };

            _dollar = new Coin() { Title = "One Dollar", Value = 1, ShortName = "O" };
            _quarter = new Coin() { Title = "Quarter", Value = .25m, ShortName = "Q" };
            _dime = new Coin() { Title = "Dime", Value = .1m, ShortName = "d" };
            _nickle = new Coin() { Title = "Nickle", Value = .05m, ShortName = "n" };
            _penny = new Coin() { Title = "Penny", Value = .01m, ShortName = "p" };

            _slots = new List<Slot>() { slot_a, slot_b };

            _maxSlots = 5;

            _machineService = new MachineService(_maxSlots, _purchaseServiceMock.Object);
        }
示例#2
0
 public void AddCoin(Coin coin)
 {
     _machine.Coins.Add(coin);
 }