public void TestPopOptions() { IFancyCalculator x = new FancyCalculator(); for (int i = 1; i <= 3; i++) { x.Push(i); } Assert.IsTrue(x.Size() == 3); Assert.IsTrue(x.Top() == 3); x.Pop(); Assert.IsTrue(x.Top() == 2); for (int i = 1; i <= 3; i++) { x.Push(i + 3); } Assert.IsTrue(x.Top() == 6); Assert.IsTrue(x.Size() == 5); x.Pop(); Assert.IsTrue(x.Size() == 4); x.Pop(); Assert.IsTrue(x.Size() == 3); Assert.IsTrue(x.Top() == 4); }
public void TestSubtract() { IFancyCalculator x = new FancyCalculator(); Assert.IsTrue(x.Size() == 0); x.Push(10); x.Push(20); x.Push(30); x.Push(40); x.Subtract(); Assert.IsTrue(x.Top() == 10); }
public void TestMultiply() { IFancyCalculator x = new FancyCalculator(); var calc = x.GetStack(); Assert.IsTrue(x.Size() == 0); x.Push(10); x.Push(20); x.Push(30); x.Push(40); x.Multiply(); Assert.IsTrue(x.Top() == 1200); x.Multiply(); Assert.IsTrue(x.Top() == 24000); }
public void TestSize() { IFancyCalculator x = new FancyCalculator(); var stack = x.GetStack(); x.Push(25); Assert.AreEqual(stack.Count, x.Size()); Assert.AreEqual(x.Size(), 1); x.Push(25); Assert.AreEqual(stack.Count, x.Size()); Assert.AreEqual(x.Size(), 2); x.Push(25); Assert.AreEqual(stack.Count, x.Size()); Assert.AreEqual(x.Size(), 3); }