示例#1
0
 public void ValidateString_LegitName_ShouldPass()
 {
     try
     {
         string test = Program.ValidateString("André");
         Assert.Fail("No exception was thrown");
     }
     catch (Exception ex)
     {
         Assert.IsTrue(ex is AssertFailedException);
     }
 }
示例#2
0
 public void ValidateString_ShortName_ShouldFail()
 {
     try
     {
         string test = Program.ValidateString("");
         Assert.Fail();
     }
     catch (Exception ex)
     {
         Assert.IsTrue(ex is Exception && ex is not AssertFailedException);
     }
 }
示例#3
0
 public void ValidateString_Null_ShouldFail()
 {
     try
     {
         string test = Program.ValidateString(null);
         Assert.Fail();
     }
     catch (Exception ex)
     {
         Assert.IsTrue(ex is NullReferenceException);
     }
 }
示例#4
0
 public void ValidateString_LongName_ShouldFail()
 {
     try
     {
         string test = Program.ValidateString("JonasGardellHarEttVäldigtLångNamn");
         Assert.Fail();
     }
     catch (Exception ex)
     {
         Assert.IsTrue(ex is Exception && ex is not AssertFailedException);
     }
 }
示例#5
0
 public void ValidateString_CotainsNotALetter_ShouldFail()
 {
     try
     {
         string test = Program.ValidateString("!Test");
         Assert.Fail("No exception was thrown");
     }
     catch (Exception ex)
     {
         Assert.IsTrue(ex is Exception && ex is not AssertFailedException);
     }
 }