示例#1
0
 public void ClearTest()
 {
     Stack stack = new Stack();
     stack.Push(10);
     stack.Clear();
     Assert.IsTrue(stack.Size() == 0);
 }
 public void DivisionBadTest()
 {
     IStack stack = new Stack();
     StackCalculator calculator = new StackCalculator(stack);
     calculator.Push(10);
     calculator.Push(0);
     calculator.Division();
 }
示例#3
0
 public void PopGoodTest()
 {
     Stack stack = new Stack();
     stack.Push(10);
     stack.Push(9);
     stack.Pop();
     Assert.IsTrue(stack.Top() == 10);
 }
 public void SimpleDivisionTest()
 {
     IStack stack = new Stack();
     StackCalculator calculator = new StackCalculator(stack);
     calculator.Push(10);
     calculator.Push(2);
     calculator.Division();
     Assert.AreEqual(5, calculator.Result());
 }
示例#5
0
 public void WriteTest()
 {
     Stack stack = new Stack();
     stack.Push(10);
     stack.Push(0);
     stack.Push(100);
     string test = "100 0 10 ";
     Assert.IsTrue(stack.Write() == test);
 }
 public void StrongTest()
 {
     IStack stack = new Stack();
     StackCalculator calculator = new StackCalculator(stack);
     calculator.Push(7);
     calculator.Push(8);
     calculator.Add();
     calculator.Push(13);
     calculator.Deduct();
     calculator.Push(2);
     calculator.Division();
     Assert.AreEqual(1, calculator.Result());
 }
示例#7
0
 public ElementOfStack(Stack stack)
 {
     this.Next = stack.head;
 }
示例#8
0
 public void SizeTest()
 {
     Stack stack = new Stack();
     Assert.IsTrue(stack.Size() == 0);
 }
示例#9
0
 public void PushTest()
 {
     Stack stack = new Stack();
     stack.Push(1);
     Assert.IsTrue(stack.Size() == 1);
 }
示例#10
0
 public void PopBadTest()
 {
     Stack stack = new Stack();
     stack.Pop();
 }