Let’s Create, .NET! Project ATM Part 3 – Write a test for our method.

So let’s test our method by writing a test.

Since we create the instance of the ATM at runtime we would expect the balance to be whatever we pass as parameters.

        public void TestAdd()
            ATM atm = new ATM();

            int expectthree = atm.Add(3);
            Assert.AreEqual(4, expectthree);

Now if we build this it should fail since we are telling our AreEqual that we are expecting a 3 to be returned.

Now let’s change our expectations and instead pass a 3 and let’s see what happens.

There we go! Now in the next post let’s write a loop that maintains our console application running until we want it to quit.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: