예제 #1
0
        public void ResteTest()
        {
            Ean13 target   = new Ean13(new int[] { 4, 7, 1, 9, 5, 1, 2, 0, 0, 2, 8, 8 });
            int   expected = 1;
            int   actual;

            actual = target.Reste();
            Assert.AreEqual(expected, actual);
        }
예제 #2
0
        public void ToStringTest()
        {
            Ean13  target   = new Ean13(new int[] { 4, 7, 1, 9, 5, 1, 2, 0, 0, 2, 8, 8 });
            string expected = "4719-5120-0288-9";
            string actual;

            actual = target.ToString();
            Assert.AreEqual(expected, actual);
        }
예제 #3
0
        public void PoidsPairTest()
        {
            Ean13 target   = new Ean13(new int[] { 4, 7, 1, 9, 5, 1, 2, 0, 0, 2, 8, 8 });
            int   expected = 81;
            int   actual;

            actual = target.PoidsPair();
            Assert.AreEqual(expected, actual);
        }
예제 #4
0
 public void Ean13ConstructorTest_09()
 {
     try
     {
         Ean13 target = new Ean13(new int[] { 4, 7, 1, 9, 5, 1, 2, 0, 0, 2, 8, 140 });
     }
     catch (Exception e)
     {
         Assert.AreEqual(e.Message, "Un élément du gencode n'est pas compris entre 0 et 9");
         return;
     }
     Assert.Fail("Aucune exception n'a été soulevée");
 }
예제 #5
0
 public void Ean13ConstructorTest_11()
 {
     try
     {
         Ean13 target = new Ean13(new int[] { 4, 7, 1, 9, 5, 1, 2, 0, 0, 2, 8 });
     }
     catch (Exception e)
     {
         Assert.AreEqual(e.Message, "Un code Ean 13 doit être un tableau de 11 entiers");
         return;
     }
     Assert.Fail("Aucune exception n'a été soulevée");
 }