Ejemplo n.º 1
0
        public BaseVendingMachine(ICoinAcceptor coinAcceptor, IVendingMachineWallet wallet,
                                  IBeverageRepository beverageRepository)
        {
            if (coinAcceptor == null || wallet == null || beverageRepository == null)
            {
                throw new ArgumentNullException();
            }

            CoinAcceptor       = coinAcceptor;
            Wallet             = wallet;
            BeverageRepository = beverageRepository;
        }
Ejemplo n.º 2
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;
 }
 public void arrangeForTests()
 {
   //Arrange
   this._coinAcceptor = new CoinAcceptor();
 }
Ejemplo n.º 4
0
 public VendingMachine(ICoinAcceptor coinAcceptor, IVendingMachineWallet wallet,
                       IBeverageRepository repository)
     : base(coinAcceptor, wallet, repository)
 {
 }
 /**
  * Constructs a new coin channel whose output is connected to the indicated
  * sink.
  *
  * @param sink
  *            The device at the output end of the channel.
  */
 public CoinChannel(ICoinAcceptor sink)
 {
     this.Sink = sink;
 }