public void NombreFraisNonRembourser()
        {
            ICommercial commercialOne, commercialTwo;
            Note        noteOne, noteTwo, noteThree, noteFour, noteFive;

            ServiceCommercial sc = new ServiceCommercial();

            commercialOne = new Commercial("Tech", "Franck", 25, 'A');
            commercialTwo = new Commercial("Steel", "Man", 10, 'B');

            sc.AjouterCommercial(commercialOne);
            sc.AjouterCommercial(commercialTwo);

            noteOne = new Note(new DateTime(2020, 10, 23), commercialOne);
            noteTwo = new Note(new DateTime(2020, 10, 24), commercialOne);
            noteOne.SetGiveMoneyBack();

            noteThree = new Note(new DateTime(2020, 10, 23), commercialTwo);
            noteFour  = new Note(new DateTime(2020, 10, 24), commercialTwo);
            noteThree.SetGiveMoneyBack();

            noteFive = new Note(new DateTime(2020, 10, 23), commercialTwo);
            noteFive.SetGiveMoneyBack();
            Assert.AreEqual(2, sc.NombreFraisNonRembourser());
        }
        public void ajouterNoteTest()
        {
            ServiceCommercial sc = new ServiceCommercial();
            Commercial        c1 = new Commercial("Dupond", "Jean", 7, 'B');

            sc.ajouterCommercial(c1);
            sc.ajouterNote(c1, new DateTime(2013, 11, 15), 100);    // ajoute un frais de transport
            sc.ajouterNote(c1, new DateTime(2013, 11, 21), 15.5);   // ajoute une note de repas
            sc.ajouterNote(c1, new DateTime(2013, 11, 25), 105, 2); // ajoute une nuitée
            Assert.AreEqual(3, sc.nbFraisNonRembourses());
        }
        public void Ajouter_Note_To_Commercial()
        {
            ServiceCommercial sc         = new ServiceCommercial();
            ICommercial       commercial = new Commercial("Alan", "Bod", 8, 'A');

            sc.AjouterCommercial(commercial);

            sc.AjouterNote(commercial, new DateTime(2020, 10, 22), 250);
            sc.AjouterNote(commercial, new DateTime(2020, 10, 22), 35d);
            sc.AjouterNote(commercial, new DateTime(2020, 10, 22), 80, 2);

            Assert.AreEqual(3, commercial.GetNoteDeFrais().Count);
        }
        public void nbNotesFraisNonRembourseesTest()
        {
            Commercial        c, c1;
            ServiceCommercial sc;

            sc = new ServiceCommercial();
            c  = new Commercial("Jean", "Dupond", 25, 'A');
            c1 = new Commercial("Paul", "Duval", 10, 'B');
            sc.ajouterCommercial(c);
            sc.ajouterCommercial(c1);

            NoteFrais f, f1, f2, f3, f4;

            f  = new NoteFrais(new DateTime(2013, 11, 12), c);
            f1 = new NoteFrais(new DateTime(2013, 11, 15), c);
            f1.setFraisRembourser();
            f2 = new NoteFrais(new DateTime(2013, 11, 18), c1);
            f3 = new NoteFrais(new DateTime(2013, 11, 22), c1);
            f3.setFraisRembourser();
            f4 = new NoteFrais(new DateTime(2013, 11, 25), c1);
            f4.setFraisRembourser();
            Assert.AreEqual(2, sc.nbFraisNonRembourses());
        }
Exemple #5
0
        static void Main(string[] args)
        {
            ServiceCommercial sc1 = PersisteServiceCommercial.charge("service.sr"); //le ServiceCommercial sc1 est désérialisé

            // 3.	Code de la classe Commercial
            Console.WriteLine("3.	Code de la classe Commercial ");
            Commercial c, c1;

            c = new Commercial("Jean", "Dupond", 8, 'A');
            Console.WriteLine(c.ToString());
            Console.WriteLine();

            // 4.	Code de la classe NoteFrais
            Console.WriteLine("4.	Code de la classe NoteFrais");
            NoteFrais f, f1, f2, f3, f4, f5;

            f = new NoteFrais(new DateTime(2013, 11, 12), c);
            Console.WriteLine(f.ToString());
            Console.WriteLine();

            // 6.1 La classe FraisTransport
            Console.WriteLine("6.1 La classe FraisTransport");
            f1 = new FraisTransport(new DateTime(2013, 11, 12), c, 250);
            Console.WriteLine(f1.ToString());
            Console.WriteLine();

            // 6.2 La classe RepasMidi
            Console.WriteLine("6.2 La classe RepasMidi");
            f2 = new RepasMidi(new DateTime(2013, 11, 12), c, 35);
            Console.WriteLine(f2.ToString());
            f3 = new RepasMidi(new DateTime(2013, 11, 12), c, 15);
            Console.WriteLine(f3.ToString());
            Console.WriteLine();

            // 6.3 La classe Nuitee
            Console.WriteLine("6.3 La classe Nuitee");
            f4 = new Nuitee(new DateTime(2013, 11, 12), c, 2, 46);
            Console.WriteLine(f4.ToString());
            f5 = new Nuitee(new DateTime(2013, 11, 12), c, 3, 80);
            Console.WriteLine(f5.ToString());
            Console.WriteLine();

            // 7.	Gestion des notes de frais d'un commercial
            Console.WriteLine("7.	Gestion des notes de frais d'un commercial");
            ServiceCommercial sc;

            sc = new ServiceCommercial();
            c1 = new Commercial("Dupond", "Jean", 7, 'B');
            sc.ajouterCommercial(c1);
            sc.ajouterNote(c1, new DateTime(2013, 11, 15), 100);    // ajoute un frais de transport
            sc.ajouterNote(c1, new DateTime(2013, 11, 21), 15.5);   // ajoute une note de repas
            sc.ajouterNote(c1, new DateTime(2013, 11, 25), 105, 2); // ajoute une nuitée
            Console.WriteLine("Les frais ajouté depuis la classe service commercial : {0}", sc.nbFraisNonRembourses());

            f.setFraisRembourser();
            f1.setFraisRembourser();
            f2.setFraisRembourser();
            Console.WriteLine("Test du cumul des notes de frais remboursées en 2013 : {0} euros.", c.cumulNoteFraisRemboursees(2013));

            PersisteServiceCommercial.sauve(sc, "service.sr"); // le ServiceCommercial sc est sérialisé et enregistré en mémoire

            Console.ReadLine();
        }