コード例 #1
0
 public void OddNumberFails()
 {
     try
     {
         MyAssert.IsOdd(28);
         Assert.Fail("An AssertionException was expected but not thrown");
     }
     catch (AssertionException ae)
     {
         Assert.AreEqual(ae.Message,
                         "\texpected: odd number"
                         + System.Environment.NewLine
                         + "\tactual:  <28>",
                         "AssertionException thrown with incorrect message");
     }
     catch (Exception ex)
     {
         Assert.Fail("Expected AssertionException but caught: " + ex.ToString());
     }
 }
コード例 #2
0
 public void OddNumber()
 {
     MyAssert.IsOdd(27);
 }