public void CaracteristiqueTest()
        {
            //get
            ServiceJediReference.ServiceJediClient service = new ServiceJediReference.ServiceJediClient();
            List<CaracteristiqueWCF> result = service.getAllCaracteristique();
            BusinessLayer.BusinessManager bm = new BusinessLayer.BusinessManager();
            List<Caracteristique> original = bm.getCaracteristique();
            List<CaracteristiqueWCF> expected = new List<CaracteristiqueWCF>();
            foreach (Caracteristique cara in original)
            {
                expected.Add(new CaracteristiqueWCF(cara));
            }
            foreach (CaracteristiqueWCF cara in expected)
            {
                Assert.IsTrue(result.Exists(x=> x.Nom == cara.Nom && x.Valeur == cara.Valeur && x.Type == cara.Type && x.Definition == cara.Definition),"La caracteristique " + cara.Nom + " n'est pas presente");
            }

            //add
            CaracteristiqueWCF c = new CaracteristiqueWCF(new Caracteristique(EDefCaracteristique.Chance, "testCaract", ETypeCaracteristique.Jedi, 10));
            service.addCracteristique(c);
            result = service.getAllCaracteristique();
            Assert.IsTrue(result.Exists(x => x.Nom == c.Nom), "La caract " + c.Nom + " n'est pas presente");

            //update
            c = result.Find(x => x.Nom == "testCaract");
            c.Valeur = 20;
            service.updateCaracteristique(c);
            result = service.getAllCaracteristique();
            Assert.IsTrue(result.Exists(x => x.Nom == c.Nom && x.Valeur == 20), "La caract " + c.Nom + " n'a pas ete modifee");

            //delete
            service.deleteCaracteristique(c);
            result = service.getAllCaracteristique();
            Assert.IsTrue(!result.Exists(x => x.Nom == c.Nom), "Le caract " + c.Nom + "existe toujours");
        }
예제 #2
0
        public void StadeTest()
        {
            //get
            ServiceJediReference.ServiceJediClient service = new ServiceJediReference.ServiceJediClient();
            List <StadeWCF> result = service.getAllStade();

            BusinessLayer.BusinessManager bm = new BusinessLayer.BusinessManager();
            List <Stade>    original         = bm.getStades();
            List <StadeWCF> expected         = new List <StadeWCF>();

            foreach (Stade stade in original)
            {
                expected.Add(new StadeWCF(stade));
            }
            foreach (StadeWCF stade in expected)
            {
                Assert.IsTrue(result.Exists(x => x.Planete == stade.Planete), "Le stade " + stade.Planete + " n'est pas present");
            }

            //add
            List <Caracteristique> caracts = bm.getCaracteristique();
            StadeWCF s = new StadeWCF(new Stade(100, "stadeTest", caracts.FindAll(x => x.Id == 1)));

            service.addStade(s);
            result = service.getAllStade();
            Assert.IsTrue(result.Exists(x => x.Planete == s.Planete), "Le stade " + s.Planete + " n'est pas present");

            //update
            s          = result.Find(x => x.Planete == "stadeTest");
            s.NbPlaces = 150;
            service.updateStade(s);
            result = service.getAllStade();
            Assert.IsTrue(result.Exists(x => x.Planete == s.Planete && x.NbPlaces == 150), "Le stade " + s.Planete + " n'a pas ete modife");

            //delete
            service.deleteStade(s);
            result = service.getAllStade();
            Assert.IsTrue(!result.Exists(x => x.Planete == s.Planete), "Le stade " + s.Planete + "existe toujours");
        }
예제 #3
0
        public void CaracteristiqueTest()
        {
            //get
            ServiceJediReference.ServiceJediClient service = new ServiceJediReference.ServiceJediClient();
            List <CaracteristiqueWCF> result = service.getAllCaracteristique();

            BusinessLayer.BusinessManager bm       = new BusinessLayer.BusinessManager();
            List <Caracteristique>        original = bm.getCaracteristique();
            List <CaracteristiqueWCF>     expected = new List <CaracteristiqueWCF>();

            foreach (Caracteristique cara in original)
            {
                expected.Add(new CaracteristiqueWCF(cara));
            }
            foreach (CaracteristiqueWCF cara in expected)
            {
                Assert.IsTrue(result.Exists(x => x.Nom == cara.Nom && x.Valeur == cara.Valeur && x.Type == cara.Type && x.Definition == cara.Definition), "La caracteristique " + cara.Nom + " n'est pas presente");
            }

            //add
            CaracteristiqueWCF c = new CaracteristiqueWCF(new Caracteristique(EDefCaracteristique.Chance, "testCaract", ETypeCaracteristique.Jedi, 10));

            service.addCracteristique(c);
            result = service.getAllCaracteristique();
            Assert.IsTrue(result.Exists(x => x.Nom == c.Nom), "La caract " + c.Nom + " n'est pas presente");

            //update
            c        = result.Find(x => x.Nom == "testCaract");
            c.Valeur = 20;
            service.updateCaracteristique(c);
            result = service.getAllCaracteristique();
            Assert.IsTrue(result.Exists(x => x.Nom == c.Nom && x.Valeur == 20), "La caract " + c.Nom + " n'a pas ete modifee");

            //delete
            service.deleteCaracteristique(c);
            result = service.getAllCaracteristique();
            Assert.IsTrue(!result.Exists(x => x.Nom == c.Nom), "Le caract " + c.Nom + "existe toujours");
        }
예제 #4
0
        public void JediWCFTest()
        {
            //get
            ServiceJediReference.ServiceJediClient service = new ServiceJediReference.ServiceJediClient();
            BusinessLayer.BusinessManager          bm      = new BusinessLayer.BusinessManager();
            List <JediWCF> result   = service.getAllJedi();
            List <Jedi>    original = bm.getJedis(); //met a jour l'id
            List <JediWCF> expected = new List <JediWCF>();

            foreach (Jedi jedi in original)
            {
                expected.Add(new JediWCF(jedi));
            }
            foreach (JediWCF jedi in expected)
            {
                Assert.IsTrue(result.Exists(x => x.Nom == jedi.Nom), "Le jedi " + jedi.Nom + " n'est pas present");
            }

            //add
            List <Caracteristique> list_carac = bm.getCaracteristique().FindAll(x => x.Id == 1);
            JediWCF j = new JediWCF(new Jedi("TestAjout", false, list_carac));

            service.addJedi(j);
            result = service.getAllJedi();
            Assert.IsTrue(result.Exists(x => x.Nom == j.Nom), "Le jedi " + j.Nom + " n'est pas present");

            //update
            j        = result.Find(x => x.Nom == "TestAjout");
            j.IsSith = true;
            service.updateJedi(j);
            result = service.getAllJedi();
            Assert.IsTrue(result.Exists(x => x.Nom == j.Nom && x.IsSith == true), "Le jedi " + j.Nom + " n'a pas ete modife");

            //delete
            service.deleteJedi(j);
            result = service.getAllJedi();
            Assert.IsTrue(!result.Exists(x => x.Nom == j.Nom), "Le jedi " + j.Nom + "existe toujours");
        }
        public void JediWCFTest()
        {
            //get
            ServiceJediReference.ServiceJediClient service = new ServiceJediReference.ServiceJediClient();
            BusinessLayer.BusinessManager bm = new BusinessLayer.BusinessManager();
            List<JediWCF> result = service.getAllJedi();
            List<Jedi> original = bm.getJedis(); //met a jour l'id
            List<JediWCF> expected = new List<JediWCF>();
            foreach (Jedi jedi in original)
            {
                expected.Add(new JediWCF(jedi));
            }
            foreach (JediWCF jedi in expected)
            {
                Assert.IsTrue(result.Exists(x=> x.Nom == jedi.Nom),"Le jedi " + jedi.Nom + " n'est pas present");
            }

            //add
            List<Caracteristique> list_carac = bm.getCaracteristique().FindAll(x => x.Id == 1);
            JediWCF j = new JediWCF(new Jedi("TestAjout", false, list_carac));
            service.addJedi(j);
            result = service.getAllJedi();
            Assert.IsTrue(result.Exists(x => x.Nom == j.Nom), "Le jedi " + j.Nom + " n'est pas present");

            //update
            j = result.Find(x => x.Nom == "TestAjout");
            j.IsSith = true;
            service.updateJedi(j);
            result = service.getAllJedi();
            Assert.IsTrue(result.Exists(x => x.Nom == j.Nom && x.IsSith == true), "Le jedi " + j.Nom + " n'a pas ete modife");

            //delete
            service.deleteJedi(j);
            result = service.getAllJedi();
            Assert.IsTrue(!result.Exists(x => x.Nom == j.Nom), "Le jedi " + j.Nom + "existe toujours");
        }
        public void StadeTest()
        {
            //get
            ServiceJediReference.ServiceJediClient service = new ServiceJediReference.ServiceJediClient();
            List<StadeWCF> result = service.getAllStade();
            BusinessLayer.BusinessManager bm = new BusinessLayer.BusinessManager();
            List<Stade> original = bm.getStades();
            List<StadeWCF> expected = new List<StadeWCF>();
            foreach (Stade stade in original)
            {
                expected.Add(new StadeWCF(stade));
            }
            foreach (StadeWCF stade in expected)
            {
                Assert.IsTrue(result.Exists(x=> x.Planete == stade.Planete),"Le stade " + stade.Planete + " n'est pas present");
            }

            //add
            List<Caracteristique> caracts = bm.getCaracteristique();
            StadeWCF s = new StadeWCF(new Stade(100, "stadeTest", caracts.FindAll(x => x.Id == 1)));
            service.addStade(s);
            result = service.getAllStade();
            Assert.IsTrue(result.Exists(x => x.Planete == s.Planete), "Le stade " + s.Planete + " n'est pas present");

            //update
            s = result.Find(x => x.Planete == "stadeTest");
            s.NbPlaces = 150;
            service.updateStade(s);
            result = service.getAllStade();
            Assert.IsTrue(result.Exists(x => x.Planete == s.Planete && x.NbPlaces == 150), "Le stade " + s.Planete + " n'a pas ete modife");

            //delete
            service.deleteStade(s);
            result = service.getAllStade();
            Assert.IsTrue(!result.Exists(x => x.Planete == s.Planete), "Le stade " + s.Planete + "existe toujours");
        }