Example #1
0
        public void CreerCommande()
        {
            Controleur           controleur = new CommandeControleur();
            List <LigneCommande> Produit    = new List <LigneCommande>();

            controleur.CreerCommande(controleur.GetClients().Last(), Produit);
            Assert.AreEqual(controleur.GetCommandes().Last().LignesCommande, Produit);
            Assert.AreEqual(controleur.GetCommandes().Last().Client, controleur.GetClients().Last());
        }
Example #2
0
        public void TestCommande()
        {
            CommandeControleur ctrl = new CommandeControleur();

            Commande co = new Commande();

            co.Client         = "Tony";
            co.LignesCommande = 3;



            ctrl.CreerCommande(co.Client, co.LignesCommande);
            Assert.AreEqual("Tony", ctrl.GetCommandes().Last().Client);
        }
Example #3
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);
        }
        public void TestAddCommande()
        {
            Controleur controleur = new CommandeControleur();
            Client     j          = new Client();

            j.Id  = 666;
            j.Nom = "Castor"; j.Prenom = "Janounours"; j.Mail = "*****@*****.**";

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

            c.Client = j; c.LignesCommande = lgCmd; c.Id = 666;

            controleur.CreerCommande(j, lgCmd);
            Assert.AreEqual(j, controleur.GetCommandes().Last().Client);
            Assert.AreEqual(lgCmd, controleur.GetCommandes().Last().LignesCommande);
        }
Example #5
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 #6
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 #7
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);
        }
Example #8
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.
        }
        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);
        }