コード例 #1
0
 /// <summary>
 /// Initialization constructor
 /// </summary>
 /// <param name="coinAcceptor">Coin acceptor interface to use</param>
 /// <param name="coinAppraiser">Coin appraiser interface to use</param>
 /// <param name="coinReturn">Coin return, with coins and their quanities</param>
 /// todo: IoC needed here down the road
 public VendingMachine(
   ICoinAcceptor coinAcceptor,
   ICoinAppraiser coinAppraiser,
   IDictionary<InsertedCoin, int> coinReturn,
   IDisplay display,
   IProductSelector productSelector,
   IChangeProvider changeProvider,
   IDictionary<InsertedCoin, int> internalSafe)
 {
   this.CoinAcceptor = coinAcceptor;
   this.CoinAppraiser = coinAppraiser;
   this.CoinReturn = coinReturn;
   this.Display = display;
   this.Display.Message = VendingMachine.InsertCoinsMessage;
   this.ProductSelectorButtons = productSelector;
   this.ProductSelectorButtons.OnSelectedProductChanged += this.OnProductSelected;
   this.ChangeProvider = changeProvider;
   this.InternalSafe = internalSafe;
 }
コード例 #2
0
        public void SetUp()
        {
            _changeProvider = Substitute.For <IChangeProvider>();

            _vendingMachine = new VendingMachine(_changeProvider);
        }
コード例 #3
0
 public VendingMachine(IChangeProvider changeProvider)
 {
     _changeProvider = changeProvider;
 }
コード例 #4
0
 public void arrangeForTests()
 {
   //Arrange
   this._changeProvider = new ChangeProvider();
   this._coinAppraiser = new CoinAppraiser();              //todo: evaluate use of mock
 }
コード例 #5
0
        public void SetUp()
        {
            _coinsAvability = Substitute.For <ICoinsAvability>();

            _changeProvider = new ChangeProvider(_coinsAvability);
        }