Beispiel #1
0
        public void AddActivity(Activity a)
        {
            if (listActivities.Count() < maxAct)
                ListActivities.Add(a);

            else Console.Write("Trop d'activités ajoutées à " + this);
        }
Beispiel #2
0
 public void TestMethod1()
 {
     //AAA
     //1. Arrange => Instancie
     Pupil p = new Pupil("pupil1", 20, 1);
     Activity a = new Activity("act2", true);
     //2. Act => On utilise
     p.AddActivity(a);
     p.AddEvaluation("act2", 'd');
     //3. Assert => On compare résultat obtenu et on compare
     var evaluation = p.GetEvaluationFor("act2");
     Assert.AreEqual('d', evaluation);
 }
Beispiel #3
0
 public void TestForException()
 {
     //AAA
     //1.Arrange
     Pupil p = new Pupil("pupil1", 20, 1);
     Activity a = new Activity("act2", true);
     //2.Act
     p.AddActivity(a);
     p.AddEvaluation("act2", 'd');
     //3.Assert
     var evaluation = p.GetEvaluationFor("act3");
     Assert.AreEqual('d', evaluation);
 }
Beispiel #4
0
        static void Main(string[] args)
        {
            Pupil elv1 = new Pupil("Ginetti", 22,1);
            Activity act1 = new Activity("Math", true);
            Activity act2 = new Activity("Rel", false);
            Activity act3 = new Activity("Anglais", true);
            elv1.AddActivity(act1);
            elv1.AddActivity(act2);
            elv1.AddActivity(act3);

            System.Console.Write(elv1);
            System.Console.Read();
        }
Beispiel #5
0
        static void Main(string[] args)
        {
            Pupil aurel = new Pupil("Aurel", 6, 1);
            Pupil quentin = new Pupil("Quentin", 22, 1);
            Pupil paul = new Pupil("Paul", 5, 1);

            Person maxime = new Person("Maxime", 10);
            Person chris = new Person("Chris", 2);

            Pupil aurel2 = new Pupil("Aurel", 6, 1);
            Pupil quentin2 = new Pupil("Quentin", 22, 1);
            Pupil jean = new Pupil("Jean", 5, 1);

            List<Person> listPersons = new List<Person>();

            List<Pupil> listPupils = new List<Pupil>();

            List<Pupil> listPupilsDuplicated = new List<Pupil>();
            listPupilsDuplicated.Add(aurel2);
            listPupilsDuplicated.Add(quentin2);
            listPupilsDuplicated.Add(jean);

            //{
            //    new Pupil("Aurel", 6, 1);
            //    new Pupil("Quentin", 22, 1);
            //    new Pupil("Paul", 5, 1);
            //}

            listPupils.Add(aurel);
            listPupils.Add(quentin);
            listPupils.Add(paul);

            listPersons.Add(maxime);
            listPersons.Add(chris);

            var listFusion = listPersons.Union(listPupils);

            IEnumerable<Pupil> listPupilsNoDuplicated = listPupilsDuplicated.Distinct<Pupil>(new PersonComparer());
            foreach (var pers in listPupilsNoDuplicated)
            {
                System.Console.Write(pers);
            }
            Debug.
            System.Console.Read();

            Activity act1 = new Activity("coloriage", true);
            Activity act2 = new Activity("français", false);
            Activity act3 = new Activity("sieste", true);

            //aurel.AddActivity(act1);
            //aurel.AddActivity(act2);
            //aurel.AddActivity(act3);
            aurel.AddActivity("français");
            aurel.AddActivity("sieste");

            aurel.AddEvaluation("coloriage");
            aurel.AddEvaluation(evaluation: 'T', title: "sieste");

            //            var pupilGrade1Plus6 = from pupil in listPupils
            //                                   where pupil.Grade == 1 && pupil.Age >= 6
            //                                   select pupil;
            var pupilGrade1Plus6 = listPupils.FindAll(p => p.Grade == 1 && p.Age >= 6);

            if (pupilGrade1Plus6 != null)
            {
                foreach (var pupil in pupilGrade1Plus6)
                {
                    System.Console.Write(pupil);
                }
            }

            //System.Console.Write(aurel);
            System.Console.Read();
        }
Beispiel #6
0
 public void AddActivity(Activity labelActivity)
 {
     LstActivity.Add(labelActivity);
 }
Beispiel #7
0
 public void AddActivity(Activity act)
 {
     ListActivity.Add(act);
 }