public void Cant_Deposit_Money_Is_Not_Closed() { _sut = new Account(true, false, false, 1000, "Germán Küber", () => { }); _atmMachine = new AtmMachine(_sut); Assert.Throws <AccountClosedException>(() => _atmMachine.Deposit(100)); }
public void Cant_Deposit_Money_Is_Not_Closed() { Assert.Throws <AccountClosedException>(() => _atmMachine.Deposit(100)); }
public void TransactionMenuToDeposit() { this.TestContext.WriteLine("Given"); this.TestContext.WriteLine("* A user is at the transaction menu"); this.TestContext.WriteLine("When"); this.TestContext.WriteLine("* An Button1 is pressed"); this.TestContext.WriteLine("Then"); this.TestContext.WriteLine("* The transaction menu should enter the Deposit state and immediately"); this.TestContext.WriteLine("* transition to the exit state via a null transition"); this.TestContext.WriteLine("Test scenario completed in Exercise 4"); var testViewModel = new TestAtmViewModel(); var atmMachine = new AtmMachine(testViewModel); try { // Turn the power on atmMachine.TurnPowerOn().WaitForWorkflow(); // Insert an valid card atmMachine.InsertCard(true).WaitForWorkflow(); // Enter a pin ends with Keypad Enter atmMachine.AcceptPin("1234").WaitForWorkflow(); // Press button 3 atmMachine.Deposit().WaitForWorkflow(); // Turn off the ATM atmMachine.TurnPowerOff().Wait(); // Verify the states AssertState.OccursInOrder( "Transaction Menu StateMachine", testViewModel.Records, TransactionMenuState.TransactionMenu, TransactionMenuState.Deposit, TransactionMenuState.Exit); AssertState.OccursInOrder( "ATM StateMachine", testViewModel.Records, AtmState.Initialize, AtmState.InsertCard, AtmState.EnterPin, AtmState.MainMenu); // Verify the transitions AssertHelper.OccursInOrder( "Transitions", testViewModel.Transitions, AtmTransition.PowerOn, AtmTransition.CardInserted, AtmTransition.KeypadEnter, AtmTransition.Deposit, AtmTransition.PowerOff); // Verify the prompts AssertHelper.OccursInOrder( "Prompts", testViewModel.Prompts.ConvertAll((prompt) => prompt.Text), Prompts.PleaseWait, Prompts.InsertCard, Prompts.EnterYourPin); // Verify the valid card Assert.AreEqual(1, testViewModel.CardReaderResults.Count); Assert.AreEqual(CardStatus.Valid, testViewModel.CardReaderResults[0].CardStatus); // Verify the exit action cleared the screen at least twice Assert.IsTrue(testViewModel.ClearCount >= 4, "Verify that you added the ClearView activity to the Exit Action of states that require it"); // Verify the camera control AssertHelper.OccursInOrder("CameraControl", testViewModel.CameraControl, true); } finally { testViewModel.Trace(this.TestContext); } }