コード例 #1
0
ファイル: Tests.cs プロジェクト: JanouCrastes/Commande
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
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);
        }
コード例 #4
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);
        }
コード例 #5
0
        public void AjoutClientOK()
        {
            Controleur control = new CommandeControleur();

            control.CreerClient("Moriceau", "Alexis", "*****@*****.**");
            Assert.AreEqual("Moriceau", control.GetClients().Last().Nom);
            Assert.AreEqual("Alexis", control.GetClients().Last().Prenom);
            Assert.AreEqual("*****@*****.**", control.GetClients().Last().Mail);
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        public void TestAddClient()
        {
            Controleur controleur = new CommandeControleur();

            controleur.CreerClient("Langer", "Bebel", "*****@*****.**");
            Assert.AreEqual("Langer", controleur.GetClients().Last().Nom);
            Assert.AreEqual("Bebel", controleur.GetClients().Last().Prenom);
            Assert.AreEqual("*****@*****.**", controleur.GetClients().Last().Mail);
        }
コード例 #8
0
        static void Main(string[] args)
        {
            Controleur controleur = new CommandeControleur();
            MainVue    vue        = new MainVue(controleur);

            ICollection <Client> Clients = new Collection <Client>();

            vue.start();
        }
コード例 #9
0
ファイル: Tests.cs プロジェクト: JanouCrastes/Commande
        public void CreerClient()
        {
            Controleur controleur = new CommandeControleur();

            controleur.CreerClient("Crastes", "Janou", "*****@*****.**");
            Assert.AreEqual(controleur.GetClients().Last().Prenom, "Janou");
            Assert.AreEqual(controleur.GetClients().Last().Nom, "Crastes");
            Assert.AreEqual(controleur.GetClients().Last().Mail, "*****@*****.**");
        }
コード例 #10
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());
        }
コード例 #11
0
        public void CreerClient()
        {
            Controleur controleur = new CommandeControleur();

            controleur.CreerClient("Besseau", "William", "*****@*****.**");
            Assert.AreEqual(controleur.GetClients().Last().Nom, "Besseau");
            Assert.AreEqual(controleur.GetClients().Last().Prenom, "William");
            Assert.AreEqual(controleur.GetClients().Last().Mail, "*****@*****.**");
        }
コード例 #12
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);
        }
コード例 #13
0
        public void TestCreateClientOk()
        {
            Controleur ctrl = new CommandeControleur();

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

            Assert.AreEqual("Wilson", ctrl.GetClients().Last().Nom);
            Assert.AreEqual("Wade", ctrl.GetClients().Last().Prenom);
            Assert.AreEqual("*****@*****.**", ctrl.GetClients().Last().Mail);
        }
コード例 #14
0
        public void TestCreerClient()
        {
            Controleur controleur = new CommandeControleur();

            controleur.CreerClient("Minhoto", "Theo", "*****@*****.**");

            Assert.AreEqual("Minhoto", controleur.GetClients().Last().Nom);
            Assert.AreEqual("Theo", controleur.GetClients().Last().Prenom);
            Assert.AreEqual("*****@*****.**", controleur.GetClients().Last().Mail);
        }
コード例 #15
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
        }
コード例 #16
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);
        }
コード例 #17
0
        public void CreerClientOK()
        {
            Controleur controller = new CommandeControleur();
            ClientDao  client     = new ClientDao();
            int        un         = client.Clients.Count();

            controller.CreerClient("DINDELEUX", "César", "*****@*****.**");
            Assert.AreEqual(controller.GetClients().Last().Id, un + 1);                        // Vérifier que l'ID est bien augmenté de 1.
            Assert.AreEqual(controller.GetClients().Last().Nom, "DINDELEUX");                  // Vérifier que le nom est bien inséré et correct
            Assert.AreEqual(controller.GetClients().Last().Prenom, "César");                   // Vérifier que le prénom est bien inséré et correct
            Assert.AreEqual(controller.GetClients().Last().Mail, "*****@*****.**"); // Vérifier que le mail est bien inséré et correct
            Assert.AreEqual(controller.GetClients().Last().Commandes.Count(), 0);              // Vérifier qu'à la création, ses commandes soient bien vides.
        }
コード例 #18
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
        }
コード例 #19
0
        public void TestAjoutClientOk()
        {
            Controleur c        = new CommandeControleur();
            ClientDao  client   = new ClientDao();
            int        unclient = client.Clients.Count();

            c.AjouterClient("Gaborit", "Joan", "*****@*****.**");
            Assert.AreEqual(c.GetClients().Last().Id, unclient + 1);
            Assert.AreEqual(c.GetClients().Last().Nom, "Gaborit");
            Assert.AreEqual(c.GetClients().Last().Prenom, "Joan");
            Assert.AreEqual(c.GetClients().Last().Mail, "*****@*****.**");
            //J'ajoute un client avec un nom, un prénom et une adresse mail et je vérifie si le dernier client ajouté est bien égal aux informations
            //concernant l'ajout du client
        }
コード例 #20
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);
        }
コード例 #21
0
        public void TestAjoutClient()
        {
            CommandeControleur ctrl = new CommandeControleur();

            Client c = new Client();

            c.Nom       = "Tourman";
            c.Prenom    = "Benjamin";
            c.Mail      = "*****@*****.**";
            c.Commandes = new List <Commande>();

            ctrl.CreerClient(c.Nom, c.Prenom, c.Mail, c.Commandes);
            Assert.AreEqual("Benjamin", ctrl.GetClients().Last().Prenom);
        }
コード例 #22
0
        public void TestAjoutClient()
        {
            CommandeControleur ctrl = new CommandeControleur();

            //initilisation d'un client
            Client c = new Client();

            c.Nom    = "Tourman";
            c.Prenom = "Benjamin";
            c.Mail   = "*****@*****.**";

            ctrl.CreerClient(c);

            Assert.AreEqual("Benjamin", ctrl.GetClients().Last().Prenom);
        }
コード例 #23
0
ファイル: Tests.cs プロジェクト: JanouCrastes/Commande
        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);
        }
コード例 #24
0
        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);
        }
コード例 #25
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
        }
コード例 #26
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);
        }
コード例 #27
0
        public void TestClientNoCommande()
        {
            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
            });
            List <LigneCommande> ListCommandVide = new List <LigneCommande>();

            Assert.AreEqual(Test, controleur.GetCommandes().Last().Client);
            Assert.AreNotEqual(ListCommandVide, controleur.GetCommandes().Last().LignesCommande);
        }
コード例 #28
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);
        }
コード例 #29
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.
        }