예제 #1
0
 public void testMyCountException()
 {
     try
     {
         MyClass obj = new MyClass();
         for (int i = 1; i <= int.MaxValue; i++ )
             obj.UpTheCount();
     }
     catch (OverflowException ex) { return; }
     Assert.Fail("Method did not throw OverflowException");
 }
예제 #2
0
 public void VerifyMyCountIsIncremented()
 {
     int expectedCount = 0;
     int currentCount;
     MyClass obj = new MyClass();
     currentCount = obj.MyCount;
     Assert.AreEqual(expectedCount, currentCount, "Initial Count values do not match");
     expectedCount += 2;
     obj.UpTheCount();
     obj.UpTheCount();
     currentCount = obj.MyCount;
     Assert.AreEqual(expectedCount, currentCount, "Incremented Count values do not match");
 }
예제 #3
0
 public void VerifyMyCountReturnsInteger()
 {
     MyClass obj = new MyClass();
     obj.UpTheCount();
     Assert.IsTrue(obj.MyCount.GetType() == typeof(int), "MyCount property is returning non-integer numbers");
 }