public void ValidateString_ShortName_ShouldFail()
 {
     try
     {
         string test = Program.ValidateString("");
         Assert.Fail();
     }
     catch (Exception ex)
     {
         Assert.IsTrue(ex is Exception && ex is not AssertFailedException);
     }
 }
 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);
     }
 }
 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);
     }
 }
 public void ValidateString_Null_ShouldFail()
 {
     try
     {
         string test = Program.ValidateString(null);
         Assert.Fail();
     }
     catch (Exception ex)
     {
         Assert.IsTrue(ex is NullReferenceException);
     }
 }
 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);
     }
 }
Exemple #6
0
        public void TestMethod1()
        {
            ConsoleApp2.Program calc = new ConsoleApp2.Program();
            int i = ConsoleApp2.Program.alg(2, '*', 3);

            if (i == 6)
            {
                int j = ConsoleApp2.Program.alg1(6, '+', 3);
                if (j != 9)
                {
                    Console.WriteLine("´íÎó");
                }
            }
            else
            {
                Console.WriteLine("´íÎó");
            }
        }
Exemple #7
0
 public void TestMethod1()
 {
     ConsoleApp2.Program p = new ConsoleApp2.Program();
     Assert.AreEqual(p.sum(2, 5), 7);
     Assert.AreEqual(p.sum(12, 5), 17);
 }