コード例 #1
0
    static void Main(string[] args)
    {
        var         mock        = new MockMessagePrinter();
        ATMCustomer atmCustomer = new ATMCustomer(mock, new RepoTransaction());

        atmCustomer.PlaceDeposit(new BankAccount(), 0);
        Console.WriteLine(mock.Message == "Amount needs to be more than zero. Try again.");
        Console.ReadLine();
    }
コード例 #2
0
    public void Should_ShowZeroErrorMessage_OnPlaceDeposit_When_AmountIsZero()
    {
        var         mock        = new MockMessagePrinter();
        ATMCustomer atmCustomer = new ATMCustomer(mock, new RepoTransaction());

        atmCustomer.PlaceDeposit(new BankAccount(), 0);
        var expectedMessage = "Amount needs to be more than zero. Try again.";

        Assert.AreEqual(expectedMessage, mock.Message);
    }