コード例 #1
0
 public void Div_DivideByZero_ThrowsException()
 {
     var calc = new StackCalculator();
     calc.Push(20);
     calc.Push(0);
     Exception e = Assert.Throws<DivideByZeroException>(() => calc.Div());
 }
コード例 #2
0
 public void Div_DividingValues_ValuesDivided()
 {
     var calc = new StackCalculator();
     calc.Push(200);
     calc.Push(100);
     calc.Div();
     Expect(calc.Pop(), Is.EqualTo(200 / 100));
 }
コード例 #3
0
 public void Div_DividingWhereStackCountIsLessThanTwo_ThrowsException()
 {
     var calc = new StackCalculator();
     calc.Push(200);
     Exception e = Assert.Throws<ArgumentException>(() => calc.Div());
 }