Example #1
0
        public void AjoutProduitOK()
        {
            Controleur controler = new CommandeControleur();

            controler.CreerProduit("Tournevis", 12);
            Assert.AreEqual("Tournevis", controler.GetProduits().Last().Designation);
            Assert.AreEqual(12, controler.GetProduits().Last().Prix);
        }
Example #2
0
        public void CreerProduit()
        {
            Controleur controleur = new CommandeControleur();

            controleur.CreerUnProduit("Carotte", 500);
            Assert.AreEqual(controleur.GetProduits().Last().Designation, "Carotte");
            Assert.AreEqual(controleur.GetProduits().Last().Prix, 500);
        }
Example #3
0
        public void CreerProduit()
        {
            Controleur controleur = new CommandeControleur();

            controleur.CreerProduit("Banane", 15);
            Assert.AreEqual(controleur.GetProduits().Last().Designation, "Banane");
            Assert.AreEqual(controleur.GetProduits().Last().Prix, 15);
        }
        public void TestAddProduit()
        {
            Controleur controleur = new CommandeControleur();

            controleur.CreerProduit("Téléphone portable de type bien", 666);
            Assert.AreEqual("Téléphone portable de type bien", controleur.GetProduits().Last().Designation);
            Assert.AreEqual(666, controleur.GetProduits().Last().Prix);
        }
Example #5
0
        public void TestCreateProduitOk()
        {
            Controleur ctrl = new CommandeControleur();

            ctrl.CreerProduit("Chimichangas", 20);

            Assert.AreEqual("Chimichanga", ctrl.GetProduits().Last().Designation);
            Assert.AreEqual(20, ctrl.GetProduits().Last().Prix);
        }
        public void TestCreerProduit()
        {
            Controleur controleur = new CommandeControleur();

            controleur.CreerProduit("Jambe", 10);

            Assert.AreEqual("Jambe", controleur.GetProduits().Last().Designation);
            Assert.AreEqual(10, controleur.GetProduits().Last().Prix);
        }
Example #7
0
        public void CreerProduitOK()
        {
            Controleur controller = new CommandeControleur();
            ProduitDao produit    = new ProduitDao();
            int        un         = produit.Produits.Count();

            controller.CreerProduit("Nintendo Switch", 299);
            Assert.AreEqual(controller.GetProduits().Last().Id, un + 1);                     // Vérifier que l'ID est bien augmenté de 1.
            Assert.AreEqual(controller.GetProduits().Last().Designation, "Nintendo Switch"); // Vérifier que la désignation est bien insérée et correcte
            Assert.AreEqual(controller.GetProduits().Last().Prix, 299);                      // Vérifier que le prix est bien inséré et correct
        }
Example #8
0
        public void TestAjoutProduitOk()
        {
            Controleur c1        = new CommandeControleur();
            ProduitDao produit   = new ProduitDao();
            int        unproduit = produit.Produits.Count();

            c1.CreerProduit("Iphone", "749");
            Assert.AreEqual(c1.GetProduits().Last().Id, unproduit + 1);
            Assert.AreEqual(c1.GetProduits().Last().Designation, "Iphone");
            Assert.AreEqual(c1.GetProduits().Last().Prix, "749");
            //J'ajoute un produit avec une désignation et un prix et je vérifie si le dernier produit ajouté est bien égal aux informations
            //concernant l'ajout du produit
        }
Example #9
0
        public void CreerCommande()
        {
            Controleur           controleur = new CommandeControleur();
            List <LigneCommande> Produits   = new List <LigneCommande>();

            Produits.Add(new LigneCommande()
            {
                Produit = controleur.GetProduits().Last(), Quantite = 5
            });
            Produits.Add(new LigneCommande()
            {
                Produit = controleur.GetProduits().First(), Quantite = 10
            });
            controleur.CreerCommande(controleur.GetClients().Last(), Produits);
            Assert.AreEqual(controleur.GetCommandes().Last().Client, controleur.GetClients().Last());
            Assert.AreEqual(controleur.GetCommandes().Last().LignesCommande, Produits);
        }
Example #10
0
        public void TestAjoutCommandeOk()
        {
            Controleur c2     = new CommandeControleur();
            Client     client = c2.GetClients().Last();
            ICollection <LigneCommande> lignesCommande = new Collection <LigneCommande>();
            LigneCommande ligneCmd = new LigneCommande()
            {
                Produit = c2.GetProduits().First(), Quantite = 2
            };

            lignesCommande.Add(ligneCmd);
            c2.CreerCommande(client, lignesCommande);
            Assert.AreEqual(c2.GetCommandes().Last().Client, client);
            Assert.AreEqual(c2.GetProduits().First().Id, 1);
            Assert.AreEqual(c2.GetCommandes().Last().LignesCommande.Last().Quantite, 2);
            //J'ajoute une commande qui contient un le dernier client de la liste, le premier produit de la liste et une quantité à 2
            //Je vérifie qu'il me retourne bien que le dernier client de la liste commande bien 2 fois le premier produit de la liste
        }
Example #11
0
        public void CreerCommandeOK()
        {
            Controleur    controller = new CommandeControleur();
            Client        c1         = controller.GetClients().Last();
            Produit       produit    = controller.GetProduits().Last();
            LigneCommande ligneCMD   = new LigneCommande()
            {
                Produit = controller.GetProduits().Last(), Quantite = 17
            };
            ICollection <LigneCommande> CommandeComplete = new Collection <LigneCommande>();

            CommandeComplete.Add(ligneCMD);

            //AJOUTER LE TEST DE LA COMMANDE.


            controller.CreerCommande(c1, CommandeComplete);
            Assert.AreEqual(controller.GetCommandes().Last().Client, c1);                       // Vérifier que la commande prend bien en compte un client
            Assert.AreEqual(controller.GetCommandes().Last().LignesCommande, CommandeComplete); // Vérifier que la commande prend bien en compte la collection de ligne de cmd.
        }
Example #12
0
        public void TestAjoutProduit()
        {
            CommandeControleur ctrl = new CommandeControleur();

            Produit p = new Produit();

            p.Designation = "String XL";
            p.Prix        = 15;

            ctrl.CreerProduit(p.Designation, p.Prix);
            Assert.AreEqual("String XL", ctrl.GetProduits().Last().Designation);
        }
        public void TestCreerCommande()
        {
            Controleur controleur = new CommandeControleur();
            Client     Test       = new Client();

            Test.Nom    = "Minhoto";
            Test.Prenom = "Theo";
            Test.Mail   = "*****@*****.**";
            List <LigneCommande> Listecommand = new List <LigneCommande>();

            Listecommand.Add(new LigneCommande()
            {
                Produit = controleur.GetProduits().First(), Quantite = 2
            });
            Listecommand.Add(new LigneCommande()
            {
                Produit = controleur.GetProduits().Last(), Quantite = 2
            });
            controleur.CreerCommande(Test, Listecommand);

            Assert.AreEqual(Test, controleur.GetCommandes().Last().Client);
            Assert.AreEqual(Listecommand, controleur.GetCommandes().Last().LignesCommande);
        }
Example #14
0
        public void AjoutCommandeOK()
        {
            Controleur control = new CommandeControleur();
            Client     Clt     = new Client();

            Clt.Nom    = "Moriceau";
            Clt.Prenom = "Alexis";
            Clt.Mail   = "*****@*****.**";
            List <LigneCommande> lsc = new List <LigneCommande>();

            lsc.Add(new LigneCommande()
            {
                Produit = control.GetProduits().First(), Quantite = 500
            });
            control.CreerCommande(Clt, lsc);

            Assert.AreEqual(Clt, control.GetCommandes().Last().Client);
            Assert.AreEqual(lsc, control.GetCommandes().Last().LignesCommande);
        }
Example #15
0
        public void TestCreateCommandeOk()
        {
            Controleur ctrl = new CommandeControleur();

            ctrl.CreerClient("Wilson", "Wade", "*****@*****.**");
            ctrl.CreerProduit("Chimichanga", 20);

            List <LigneCommande> lgCmd = new List <LigneCommande>();

            lgCmd.Add(new LigneCommande()
            {
                Produit = ctrl.GetProduits().Last(), Quantite = 1
            });

            ctrl.CreerCommande(ctrl.GetClients().Last(), lgCmd);

            Assert.AreEqual(ctrl.GetClients().Last(), ctrl.GetCommandes().Last().Client);
            Assert.AreEqual(lgCmd, ctrl.GetCommandes().Last().LignesCommande);
        }