예제 #1
0
        public void FctQuiLeDernierElement()
        {
            LinqImpl linqImpl = new LinqImpl();
            var      resultat = linqImpl.DernierElement();

            Assert.Equal("train", resultat);
        }
예제 #2
0
        public void FctRetourneNullSiIlYAPlusDUnElement()
        {
            LinqImpl linqImpl = new LinqImpl();

            var resultat = linqImpl.SeulElementOuNull('z');

            Assert.Null(resultat);
        }
예제 #3
0
        public void FctQuiRetourneLesMotsOrdonnesContenantUnCaractere()
        {
            LinqImpl linqImpl = new LinqImpl();
            var      expected = new[] { "armoire", "avion", "chaine", "chat", "étagère", "maison", "train" };

            var resultat = linqImpl.Contient('a');

            Assert.Equal(expected, resultat);
        }
예제 #4
0
        public void FctQuiLeSeulElement()
        {
            LinqImpl linqImpl = new LinqImpl();

            linqImpl.liste = new [] { linqImpl.liste.First() };
            var resultat = linqImpl.SeulElement('a');

            Assert.Equal("avion", resultat);
        }
예제 #5
0
        public void RetourneNullSiLELementNHexistePas()
        {
            LinqImpl linqImpl = new LinqImpl();
            string   expected = null;

            var resultat = linqImpl.PremierElementOuNull('z');

            Assert.Equal(expected, resultat);
        }
예제 #6
0
        public void RetourneLePremierElementContenantUnCaractere2()
        {
            LinqImpl linqImpl = new LinqImpl();
            var      expected = "armoire";

            var resultat = linqImpl.PremierElementOuNull('e');

            Assert.Equal(expected, resultat);
        }
예제 #7
0
        public void FctRetourne5ElementsSansLes5Premiers()
        {
            LinqImpl linqImpl = new LinqImpl();

            var resultat = linqImpl.SkipFiveTakeFive();

            Assert.Equal(new[]
            {
                "chat",
                "bière",
                "C#",
                "chaine",
                "maison"
            }, resultat);
        }
예제 #8
0
        public void FctRetourne5PremierElements()
        {
            LinqImpl linqImpl = new LinqImpl();

            var resultat = linqImpl.FirstFive();

            Assert.Equal(new[]
            {
                "avion",
                "armoire",
                "étagère",
                "mère",
                "chien"
            }, resultat);
        }
예제 #9
0
        public void FctRetourneLesEgalites()
        {
            string[] param =
            {
                "armoire",
                "étagère",
                "mère",
                "chaussure"
            };

            LinqImpl linqImpl = new LinqImpl();

            var resultat = linqImpl.Similaire(param);

            Assert.Equal(new[]
            {
                "armoire",
                "étagère",
                "mère"
            }, resultat);
        }
예제 #10
0
        public void FctPlanteSiIlYAPLusDUnElement()
        {
            LinqImpl linqImpl = new LinqImpl();

            Assert.Throws <InvalidOperationException>(() => linqImpl.SeulElement('a'));
        }
예제 #11
0
        public void RetourneUneExceptionSiLELementNHexistePas()
        {
            LinqImpl linqImpl = new LinqImpl();

            Assert.Throws <InvalidOperationException>(() => linqImpl.PremierElement('z'));
        }