コード例 #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;
        }
コード例 #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;
 }
コード例 #3
0
 public void arrangeForTests()
 {
   //Arrange
   this._coinAcceptor = new CoinAcceptor();
 }
コード例 #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;
 }