Beispiel #1
0
 public void Alg2Test_ShortString()
 {
     try
     {
         Algorithms.Alg2("n");
     }
     catch (Exception ex)
     {
         // Doesn't check for too short string
         Debug.WriteLine(ex.Message);
         Assert.Fail();
     }
 }
Beispiel #2
0
 public void Alg2Test_EmptyString()
 {
     //try
     {
         Assert.ThrowsException <System.ArgumentOutOfRangeException>(() => { Algorithms.Alg2("n"); });
     }
     //catch (Exception ex)
     {
         // Doesn't check for too short string
         //Debug.WriteLine(ex.Message);
         //Assert.Fail();
     }
 }
Beispiel #3
0
 [DataRow("Nan", "NaNaNaNa")] // Batman
 // En algoritm som tar emot en sträng och returnerar
 // fyra kopior av de två första bokstäverna från den givna strängen
 public void Alg2Test(string test, string expected)
 {
     Assert.AreEqual(expected, Algorithms.Alg2(test));
 }