public void TestBuildsInsertCoinButtonPanelWithCorrectInsertCoinButtons() { Form mainForm = new Form(); Button expectedInsertPennyButton = new Button { Name = "InsertPennyButton" }; Button expectedInsertNickelButton = new Button { Name = "InsertNickelButton" }; Button expectedInsertDimeButton = new Button { Name = "InsertDimeButton" }; Button expectedInsertQuaterButton = new Button { Name = "InsertQuarterButton" }; mainForm.Controls.Add(expectedInsertPennyButton); mainForm.Controls.Add(expectedInsertNickelButton); mainForm.Controls.Add(expectedInsertDimeButton); mainForm.Controls.Add(expectedInsertQuaterButton); MainFormController mainFormController = new MainFormController(mainForm); IInsertCoinButtonPanel insertCoinButtonPanel = mainFormController.InsertCoinButtonPanel; Assert.AreSame(expectedInsertPennyButton, insertCoinButtonPanel.InsertPennyButton); Assert.AreSame(expectedInsertNickelButton, insertCoinButtonPanel.InsertNickelButton); Assert.AreSame(expectedInsertDimeButton, insertCoinButtonPanel.InsertDimeButton); Assert.AreSame(expectedInsertQuaterButton, insertCoinButtonPanel.InsertQuarterButton); }
public InsertCoinButtonPanelController(IInsertCoinButtonPanel insertCoinButtonPanel, ICoinAccepter coinAccepter) { InsertCoinButtonPanel = insertCoinButtonPanel; CoinAccepter = coinAccepter; InsertCoinButtonPanel.InsertPennyButton.Click += InsertPennyButtonEventListener; InsertCoinButtonPanel.InsertNickelButton.Click += InsertNickelButtonEventListener; InsertCoinButtonPanel.InsertDimeButton.Click += InsertDimeButtonEventListener; InsertCoinButtonPanel.InsertQuarterButton.Click += InsertQuarterButtonEventListener; }