Esempio n. 1
0
        public void Test_Get_MotCle()
        {
            bd.SetMotCle(new BaseDonnees.Models.MotCle {
                mot       = "test",
                valeur    = 15,
                fk_theme  = "TestTheme",
                DateAjout = DateTime.Today,
                fk_Date   = DateTime.Today
            });

            BaseDonnees.Models.MotCle mc = bd.GetMotCle("test");
            Assert.IsNotNull(mc);
            Assert.AreEqual("test", mc.mot);
            Assert.AreEqual(15, mc.valeur);
            Assert.AreEqual("TestTheme", mc.fk_theme);
            Assert.AreEqual(DateTime.Today, mc.DateAjout);
            Assert.AreEqual(DateTime.Today, mc.fk_Date);
        }
Esempio n. 2
0
        public void test_bdd_ReturnValeur()
        {
            BaseDonnees.Models.MotCle mc = new BaseDonnees.Models.MotCle
            {
                mot       = "test",
                valeur    = 15,
                fk_theme  = "TestTheme",
                DateAjout = DateTime.Today,
                fk_Date   = DateTime.Today,
                Synonyme  = new BaseDonnees.Models.Synonyme()
            };

            bd.SetMotCle(mc);

            bd.SetSynonyme(new BaseDonnees.Models.Synonyme
            {
                mot       = "testSynonyme",
                DateAjout = DateTime.Today,
                fk_Date   = DateTime.Today,
                fk_trad   = mc.mot
            });

            mc = new BaseDonnees.Models.MotCle
            {
                mot       = "carotte",
                valeur    = 7,
                fk_theme  = "TestTheme",
                DateAjout = DateTime.Today,
                fk_Date   = DateTime.Today,
                Synonyme  = new BaseDonnees.Models.Synonyme()
            };

            bd.SetMotCle(mc);

            bd.SetSynonyme(new BaseDonnees.Models.Synonyme
            {
                mot       = "beurre",
                DateAjout = DateTime.Today,
                fk_Date   = DateTime.Today,
                fk_trad   = mc.mot
            });

            mc = new BaseDonnees.Models.MotCle
            {
                mot       = "grand",
                valeur    = 2,
                fk_theme  = "TestTheme",
                DateAjout = DateTime.Today,
                fk_Date   = DateTime.Today,
                Synonyme  = new BaseDonnees.Models.Synonyme()
            };

            bd.SetMotCle(mc);

            Assert.AreEqual(7, bd.retourVal("beurre"));
            Assert.AreEqual(15, bd.retourVal("test"));
            Assert.AreEqual(7, bd.retourVal("carotte"));
            Assert.AreEqual(15, bd.retourVal("testSynonyme"));
            Assert.AreEqual(2, bd.retourVal("grand"));
            Assert.AreEqual(0, bd.retourVal("plouf"));
        }
Esempio n. 3
0
        public void test_bdd_CheckPartWord()
        {
            BaseDonnees.Models.MotCle mc = new BaseDonnees.Models.MotCle
            {
                mot       = "test",
                valeur    = 15,
                fk_theme  = "TestTheme",
                DateAjout = DateTime.Today,
                fk_Date   = DateTime.Today,
                Synonyme  = new BaseDonnees.Models.Synonyme()
            };

            bd.SetMotCle(mc);

            bd.SetSynonyme(new BaseDonnees.Models.Synonyme
            {
                mot       = "testSynonyme",
                DateAjout = DateTime.Today,
                fk_Date   = DateTime.Today,
                fk_trad   = mc.mot
            });

            mc = new BaseDonnees.Models.MotCle
            {
                mot       = "carotte",
                valeur    = 7,
                fk_theme  = "TestTheme",
                DateAjout = DateTime.Today,
                fk_Date   = DateTime.Today,
                Synonyme  = new BaseDonnees.Models.Synonyme()
            };

            bd.SetMotCle(mc);

            bd.SetSynonyme(new BaseDonnees.Models.Synonyme
            {
                mot       = "beurre",
                DateAjout = DateTime.Today,
                fk_Date   = DateTime.Today,
                fk_trad   = mc.mot
            });

            mc = new BaseDonnees.Models.MotCle
            {
                mot       = "grand",
                valeur    = 2,
                fk_theme  = "TestTheme",
                DateAjout = DateTime.Today,
                fk_Date   = DateTime.Today,
                Synonyme  = new BaseDonnees.Models.Synonyme()
            };

            bd.SetMotCle(mc);

            Assert.AreEqual(true, bd.checkPartWord("je veux du beurre"));
            Assert.AreEqual(true, bd.checkPartWord("petit test"));
            Assert.AreEqual(true, bd.checkPartWord("carotte tomate"));
            Assert.AreEqual(true, bd.checkPartWord("j'ai testSynonyme"));
            Assert.AreEqual(true, bd.checkPartWord("je suis grand"));
            Assert.AreEqual(false, bd.checkPartWord("petit Test"));
            Assert.AreEqual(false, bd.checkPartWord("ici se trouve une phrase au hasard"));
        }