//---------------------------------------------------------------------------------------------
        private void m_lnkAjouterTranche_LinkClicked(object sender, EventArgs e)
        {
            m_gestionnaireEditionTranches.ValideModifs();

            CHoraireJournalier_Tranche tranche = new CHoraireJournalier_Tranche(m_elementEdite.ContexteDonnee);

            tranche.CreateNewInCurrentContexte();
            tranche.ElementAtrancheHoraireParent = m_elementEdite;
            // Recherche la dernière fin de tranche
            int derniereHeureDeFin = 0;

            foreach (CHoraireJournalier_Tranche trancheTmp in m_elementEdite.TranchesHorairesListe)
            {
                if (trancheTmp.HeureFin > derniereHeureDeFin)
                {
                    derniereHeureDeFin = trancheTmp.HeureFin;
                }
            }
            tranche.HeureDebut = derniereHeureDeFin;
            tranche.HeureFin   = tranche.HeureDebut < (22 * 60)?tranche.HeureDebut + 120:0;

            // Ajoute à la liste
            ListViewItem item = new ListViewItem();

            m_listViewTranches.Items.Add(item);
            m_listViewTranches.UpdateItemWithObject(item, tranche);
            item.Selected = true;
        }
        //---------------------------------------------------------------------------------------------
        private void m_gestionnaireEditionTranches_InitChamp(object sender, CObjetDonneeResultEventArgs args)
        {
            if (args.Objet == null)
            {
                m_panelEditionTranche.Visible = false;
                return;
            }
            m_panelEditionTranche.Visible = true;

            CHoraireJournalier_Tranche tranche = (CHoraireJournalier_Tranche)args.Objet;

            int      heure      = (int)tranche.HeureDebut / 60;
            int      minute     = tranche.HeureDebut % 60;
            DateTime heureDebut = new DateTime(2000, 1, 1, heure, minute, 0);

            m_timePickerHeureDebut.Value = heureDebut;

            heure  = (int)tranche.HeureFin / 60;
            minute = tranche.HeureFin % 60;
            DateTime heureFin = new DateTime(2000, 1, 1, heure, minute, 0);

            m_timePickerHeureFin.Value = heureFin;

            m_cmbxSelectTypeOccupationHpourTranche.ElementSelectionne = tranche.TypeOccupationHoraire;
        }
        public void TestCalendrierTroisTranchesAvecRecouvrement()
        {
            try
            {
                CTimosTestMetierApp.SessionClient.BeginTrans();
                using (CContexteDonnee contexte = new CContexteDonnee(CTimosTestMetierApp.SessionClient.IdSession, true, false))
                {
                    // Création des tranches horaires
                    // Première tranche de Jour de 8h à 11 h
                    CHoraireJournalier_Tranche t1 = new CHoraireJournalier_Tranche(contexte);
                    t1.CreateNew();
                    t1.HoraireJournalier     = (CHoraireJournalier)GetEntite(typeof(CHoraireJournalier), m_nIdHoraireJournalier, contexte);
                    t1.TypeOccupationHoraire = (CTypeOccupationHoraire)GetEntite(typeof(CTypeOccupationHoraire), m_nIdOccupationJour, contexte);
                    t1.HeureDebut            = 8 * 60; // 8 heures
                    t1.HeureFin = 12 * 60;             // 11 heures
                    Assert.IsTrue(t1.CommitEdit().Result);

                    // Deuxième tranche de Repos de 12h à 14 h
                    CHoraireJournalier_Tranche t2 = new CHoraireJournalier_Tranche(contexte);
                    t2.CreateNew();
                    t2.HoraireJournalier     = (CHoraireJournalier)GetEntite(typeof(CHoraireJournalier), m_nIdHoraireJournalier, contexte);
                    t2.TypeOccupationHoraire = (CTypeOccupationHoraire)GetEntite(typeof(CTypeOccupationHoraire), m_nIdOccupationRepos, contexte);
                    t2.HeureDebut            = 11 * 60; // 8 heures
                    t2.HeureFin = 15 * 60;              // 11 heures
                    Assert.IsTrue(t2.CommitEdit().Result);

                    // Troisième tranche dont l'occupation est indéfinie de 15h à 19h
                    CHoraireJournalier_Tranche t3 = new CHoraireJournalier_Tranche(contexte);
                    t3.CreateNew();
                    t3.HoraireJournalier     = (CHoraireJournalier)GetEntite(typeof(CHoraireJournalier), m_nIdHoraireJournalier, contexte);
                    t3.TypeOccupationHoraire = (CTypeOccupationHoraire)GetEntite(typeof(CTypeOccupationHoraire), m_nIdOccupationAstreinte, contexte);
                    t3.HeureDebut            = 14 * 60; // 8 heures
                    t3.HeureFin = 19 * 60;              // 11 heures
                    Assert.IsTrue(t3.CommitEdit().Result);

                    // On demande les Horaires à l'acteur de maintenant à demain même heure (24 heures)
                    CActeur           acteur        = (CActeur)GetEntite(typeof(CActeur), m_nIdActeur, contexte);
                    CTrancheHoraire[] listeTranches = acteur.GetHoraires(DateTime.Now.Date, DateTime.Now.Date.AddDays(1));

                    Assert.AreEqual(3, listeTranches.Length);
                    Assert.AreEqual(100, listeTranches[0].Priorite);
                    Assert.AreEqual(5, listeTranches[0].Duree);
                    Assert.AreEqual(50, listeTranches[1].Priorite);
                    Assert.AreEqual(4, listeTranches[1].Duree);
                    Assert.AreEqual(10, listeTranches[2].Priorite);
                    Assert.AreEqual(2, listeTranches[2].Duree);
                }
            }
            finally
            {
                CTimosTestMetierApp.SessionClient.RollbackTrans();
            }
        }
        //---------------------------------------------------------------------------------------------
        private void m_gestionnaireEditionTranches_MAJ_Champs(object sender, CObjetDonneeResultEventArgs args)
        {
            if (args.Objet != null && args.Objet.IsValide())
            {
                CHoraireJournalier_Tranche tranche = (CHoraireJournalier_Tranche)args.Objet;

                DateTime heureDebut = m_timePickerHeureDebut.Value;
                tranche.HeureDebut = heureDebut.Hour * 60 + heureDebut.Minute;

                DateTime heureFin = m_timePickerHeureFin.Value;
                tranche.HeureFin = heureFin.Hour * 60 + heureFin.Minute;

                tranche.TypeOccupationHoraire = (CTypeOccupationHoraire)m_cmbxSelectTypeOccupationHpourTranche.ElementSelectionne;
                CResultAErreur result = tranche.VerifieDonnees(true);
                args.Result = result;
            }
        }
        //---------------------------------------------------------------------------------------------
        private void m_lnkSupprimerTranche_LinkClicked(object sender, EventArgs e)
        {
            if (m_listViewTranches.SelectedItems.Count != 1)
            {
                return;
            }

            CHoraireJournalier_Tranche trancheToRemove =
                (CHoraireJournalier_Tranche)m_listViewTranches.SelectedItems[0].Tag;

            CResultAErreur result = trancheToRemove.Delete();

            if (m_listViewTranches.SelectedItems.Count == 1)
            {
                if (m_listViewTranches.SelectedItems[0] != null)
                {
                    m_listViewTranches.SelectedItems[0].Remove();
                }
            }
        }
        public void TestUneEOPlanifieeSimple()
        {
            try
            {
                CTimosTestMetierApp.SessionClient.BeginTrans();

                using (CContexteDonnee contexte = new CContexteDonnee(CTimosTestMetierApp.SessionClient.IdSession, true, false))
                {
                    // Jour
                    CHoraireJournalier_Tranche t1 = new CHoraireJournalier_Tranche(contexte);
                    t1.CreateNew();
                    t1.TypeOccupationHoraire = (CTypeOccupationHoraire)GetEntite(typeof(CTypeOccupationHoraire), m_nIdOccupationJour, contexte);
                    t1.HeureDebut            = 8 * 60; // 8 heures
                    t1.HeureFin = 12 * 60;             // 11 heures
                    Assert.IsTrue(t1.CommitEdit());


                    CActeur acteur = (CActeur)GetEntite(typeof(CActeur), m_nIdActeur, contexte);
                    CEntiteOrganisationnelle eo = (CEntiteOrganisationnelle)GetEntite(typeof(CEntiteOrganisationnelle), m_nIdEO, contexte);
                    // Création des EO planifiées
                    CEOplanifiee_Acteur eoPlan = new CEOplanifiee_Acteur(contexte);
                    eoPlan.CreateNew();
                    eoPlan.Date   = DateTime.Today;
                    eoPlan.Acteur = acteur;
                    eoPlan.EntiteOrganisationnelle = eo;
                    eoPlan.TrancheHoraire          = t1;
                    Assert.IsTrue(eoPlan.CommitEdit());

                    // On demande les Horaires à l'acteur de maintenant à demain même heure (24 heures)
                    CTrancheHoraire[] listeTranches = acteur.GetHoraires(DateTime.Now.Date, DateTime.Now.Date.AddDays(1));
                    Assert.AreEqual(1, listeTranches.Length);
                    Assert.AreEqual(50, listeTranches[0].Priorite);
                    Assert.AreEqual(4, listeTranches[0].Duree);
                }
            }
            finally
            {
                CTimosTestMetierApp.SessionClient.RollbackTrans();
            }
        }
        public void TestCombineEOsPlanifieesEtCalendrier()
        {
            try
            {
                CTimosTestMetierApp.SessionClient.BeginTrans();

                using (CContexteDonnee contexte = new CContexteDonnee(CTimosTestMetierApp.SessionClient.IdSession, true, false))
                {
                    //******** Calendrier **************
                    // Jour
                    CHoraireJournalier_Tranche t1 = new CHoraireJournalier_Tranche(contexte);
                    t1.CreateNew();
                    t1.HoraireJournalier     = (CHoraireJournalier)GetEntite(typeof(CHoraireJournalier), m_nIdHoraireJournalier, contexte);
                    t1.TypeOccupationHoraire = (CTypeOccupationHoraire)GetEntite(typeof(CTypeOccupationHoraire), m_nIdOccupationJour, contexte);
                    t1.HeureDebut            = 8 * 60; // 8 heures
                    t1.HeureFin = 12 * 60;             // 12 heures
                    Assert.IsTrue(t1.CommitEdit());

                    // Repos
                    CHoraireJournalier_Tranche t2 = new CHoraireJournalier_Tranche(contexte);
                    t2.CreateNew();
                    t2.HoraireJournalier     = (CHoraireJournalier)GetEntite(typeof(CHoraireJournalier), m_nIdHoraireJournalier, contexte);
                    t2.TypeOccupationHoraire = (CTypeOccupationHoraire)GetEntite(typeof(CTypeOccupationHoraire), m_nIdOccupationRepos, contexte);
                    t2.HeureDebut            = 12 * 60;
                    t2.HeureFin = 13 * 60;
                    Assert.IsTrue(t2.CommitEdit());

                    // Jour
                    CHoraireJournalier_Tranche t3 = new CHoraireJournalier_Tranche(contexte);
                    t3.CreateNew();
                    t3.HoraireJournalier     = (CHoraireJournalier)GetEntite(typeof(CHoraireJournalier), m_nIdHoraireJournalier, contexte);
                    t3.TypeOccupationHoraire = (CTypeOccupationHoraire)GetEntite(typeof(CTypeOccupationHoraire), m_nIdOccupationJour, contexte);
                    t3.HeureDebut            = 13 * 60;
                    t3.HeureFin = 17 * 60;
                    Assert.IsTrue(t3.CommitEdit());

                    // Repos de nuit
                    CHoraireJournalier_Tranche t4 = new CHoraireJournalier_Tranche(contexte);
                    t4.CreateNew();
                    t4.HoraireJournalier     = (CHoraireJournalier)GetEntite(typeof(CHoraireJournalier), m_nIdHoraireJournalier, contexte);
                    t4.TypeOccupationHoraire = (CTypeOccupationHoraire)GetEntite(typeof(CTypeOccupationHoraire), m_nIdOccupationRepos, contexte);
                    t4.HeureDebut            = 17 * 60;
                    t4.HeureFin = 8 * 60;
                    Assert.IsTrue(t4.CommitEdit());

                    // ***********  EO Planifiées *****************

                    // Repos
                    CHoraireJournalier_Tranche t5 = new CHoraireJournalier_Tranche(contexte);
                    t5.CreateNew();
                    t5.TypeOccupationHoraire = (CTypeOccupationHoraire)GetEntite(typeof(CTypeOccupationHoraire), m_nIdOccupationRepos, contexte);
                    t5.HeureDebut            = 6 * 60;
                    t5.HeureFin = (int)(12.5 * 60);  // 12H30
                    Assert.IsTrue(t5.CommitEdit());

                    // Astreinte
                    CHoraireJournalier_Tranche t6 = new CHoraireJournalier_Tranche(contexte);
                    t6.CreateNew();
                    t6.TypeOccupationHoraire = (CTypeOccupationHoraire)GetEntite(typeof(CTypeOccupationHoraire), m_nIdOccupationAstreinte, contexte);
                    t6.HeureDebut            = (int)(12.5 * 60); // 12h30
                    t6.HeureFin = (int)(20.5 * 60);              // 20H30
                    Assert.IsTrue(t6.CommitEdit());

                    // Repos
                    CHoraireJournalier_Tranche t7 = new CHoraireJournalier_Tranche(contexte);
                    t7.CreateNew();
                    t7.TypeOccupationHoraire = (CTypeOccupationHoraire)GetEntite(typeof(CTypeOccupationHoraire), m_nIdOccupationRepos, contexte);
                    t7.HeureDebut            = (int)(20.5 * 60);
                    t7.HeureFin = (int)(22.5 * 60);  // 22H30
                    Assert.IsTrue(t7.CommitEdit());

                    // Astreinte
                    CHoraireJournalier_Tranche t8 = new CHoraireJournalier_Tranche(contexte);
                    t8.CreateNew();
                    t8.TypeOccupationHoraire = (CTypeOccupationHoraire)GetEntite(typeof(CTypeOccupationHoraire), m_nIdOccupationAstreinte, contexte);
                    t8.HeureDebut            = (int)(22.5 * 60); // 12h30
                    t8.HeureFin = 6 * 60;                        // 6 H le landemain
                    Assert.IsTrue(t8.CommitEdit());

                    CActeur acteur = (CActeur)GetEntite(typeof(CActeur), m_nIdActeur, contexte);
                    CEntiteOrganisationnelle eo = (CEntiteOrganisationnelle)GetEntite(typeof(CEntiteOrganisationnelle), m_nIdEO, contexte);

                    // Création EO planifiée repos
                    CEOplanifiee_Acteur eoPlan1 = new CEOplanifiee_Acteur(contexte);
                    eoPlan1.CreateNew();
                    eoPlan1.Date   = DateTime.Today;
                    eoPlan1.Acteur = acteur;
                    eoPlan1.EntiteOrganisationnelle = eo;
                    eoPlan1.TrancheHoraire          = t5;
                    Assert.IsTrue(eoPlan1.CommitEdit());

                    // Création EO planifiée Astreinte
                    CEOplanifiee_Acteur eoPlan2 = new CEOplanifiee_Acteur(contexte);
                    eoPlan2.CreateNew();
                    eoPlan2.Date   = DateTime.Today;
                    eoPlan2.Acteur = acteur;
                    eoPlan2.EntiteOrganisationnelle = eo;
                    eoPlan2.TrancheHoraire          = t6;
                    Assert.IsTrue(eoPlan2.CommitEdit());

                    // Création EO repos
                    CEOplanifiee_Acteur eoPlan3 = new CEOplanifiee_Acteur(contexte);
                    eoPlan3.CreateNew();
                    eoPlan3.Date   = DateTime.Today;
                    eoPlan3.Acteur = acteur;
                    eoPlan3.EntiteOrganisationnelle = eo;
                    eoPlan3.TrancheHoraire          = t7;
                    Assert.IsTrue(eoPlan3.CommitEdit());

                    // Création EO astreinte
                    CEOplanifiee_Acteur eoPlan4 = new CEOplanifiee_Acteur(contexte);
                    eoPlan4.CreateNew();
                    eoPlan4.Date   = DateTime.Today;
                    eoPlan4.Acteur = acteur;
                    eoPlan4.EntiteOrganisationnelle = eo;
                    eoPlan4.TrancheHoraire          = t8;
                    Assert.IsTrue(eoPlan4.CommitEdit());

                    // On demande les Horaires à l'acteur de maintenant à demain même heure (24 heures)
                    CTrancheHoraire[] listeTranches = acteur.GetHoraires(DateTime.Today, DateTime.Today.AddDays(1));

                    Assert.AreEqual(7, listeTranches.Length);
                    Assert.AreEqual(100, listeTranches[0].Priorite);
                    Assert.AreEqual(7.5, listeTranches[0].Duree);
                }
            }
            finally
            {
                CTimosTestMetierApp.SessionClient.RollbackTrans();
            }
        }
        public void TestTroisEOsPlanifieesLeMemeJour()
        {
            try
            {
                CTimosTestMetierApp.SessionClient.BeginTrans();

                using (CContexteDonnee contexte = new CContexteDonnee(CTimosTestMetierApp.SessionClient.IdSession, true, false))
                {
                    // Repos
                    CHoraireJournalier_Tranche t2 = new CHoraireJournalier_Tranche(contexte);
                    t2.CreateNew();
                    t2.TypeOccupationHoraire = (CTypeOccupationHoraire)GetEntite(typeof(CTypeOccupationHoraire), m_nIdOccupationRepos, contexte);
                    t2.HeureDebut            = 8 * 60; // 8 heures
                    t2.HeureFin = 12 * 60;             // 12 heures
                    Assert.IsTrue(t2.CommitEdit());

                    // Jour
                    CHoraireJournalier_Tranche t3 = new CHoraireJournalier_Tranche(contexte);
                    t3.CreateNew();
                    t3.TypeOccupationHoraire = (CTypeOccupationHoraire)GetEntite(typeof(CTypeOccupationHoraire), m_nIdOccupationJour, contexte);
                    t3.HeureDebut            = 14 * 60;
                    t3.HeureFin = 19 * 60;
                    Assert.IsTrue(t3.CommitEdit());

                    // Astreinte
                    CHoraireJournalier_Tranche t4 = new CHoraireJournalier_Tranche(contexte);
                    t4.CreateNew();
                    t4.TypeOccupationHoraire = (CTypeOccupationHoraire)GetEntite(typeof(CTypeOccupationHoraire), m_nIdOccupationAstreinte, contexte);
                    t4.HeureDebut            = 19 * 60; // de 19 heures
                    t4.HeureFin = 8 * 60;               // à 8 heures le lendemain
                    Assert.IsTrue(t4.CommitEdit());

                    CActeur acteur = (CActeur)GetEntite(typeof(CActeur), m_nIdActeur, contexte);
                    CEntiteOrganisationnelle eo = (CEntiteOrganisationnelle)GetEntite(typeof(CEntiteOrganisationnelle), m_nIdEO, contexte);

                    // Création des EO planifiées
                    CEOplanifiee_Acteur eoPlan1 = new CEOplanifiee_Acteur(contexte);
                    eoPlan1.CreateNew();
                    eoPlan1.Date   = DateTime.Today.AddDays(-1);
                    eoPlan1.Acteur = acteur;
                    eoPlan1.EntiteOrganisationnelle = eo;
                    eoPlan1.TrancheHoraire          = t4; // Astreinte de la veille
                    Assert.IsTrue(eoPlan1.CommitEdit());

                    // Création des EO planifiées
                    CEOplanifiee_Acteur eoPlan2 = new CEOplanifiee_Acteur(contexte);
                    eoPlan2.CreateNew();
                    eoPlan2.Date   = DateTime.Today;
                    eoPlan2.Acteur = acteur;
                    eoPlan2.EntiteOrganisationnelle = eo;
                    eoPlan2.TrancheHoraire          = t2;
                    Assert.IsTrue(eoPlan2.CommitEdit());

                    // Création des EO planifiées
                    CEOplanifiee_Acteur eoPlan3 = new CEOplanifiee_Acteur(contexte);
                    eoPlan3.CreateNew();
                    eoPlan3.Date   = DateTime.Today;
                    eoPlan3.Acteur = acteur;
                    eoPlan3.EntiteOrganisationnelle = eo;
                    eoPlan3.TrancheHoraire          = t3;
                    Assert.IsTrue(eoPlan3.CommitEdit());

                    // Création des EO planifiées
                    CEOplanifiee_Acteur eoPlan4 = new CEOplanifiee_Acteur(contexte);
                    eoPlan4.CreateNew();
                    eoPlan4.Date   = DateTime.Today;
                    eoPlan4.Acteur = acteur;
                    eoPlan4.EntiteOrganisationnelle = eo;
                    eoPlan4.TrancheHoraire          = t4;
                    Assert.IsTrue(eoPlan4.CommitEdit());

                    // On demande les Horaires à l'acteur de maintenant à demain même heure (24 heures)
                    CTrancheHoraire[] listeTranches = acteur.GetHoraires(DateTime.Today, DateTime.Today.AddDays(1));

                    Assert.AreEqual(4, listeTranches.Length);
                    Assert.AreEqual(100, listeTranches[0].Priorite);
                    Assert.AreEqual(13, listeTranches[0].Duree);
                    Assert.AreEqual(100, listeTranches[1].Priorite);
                    Assert.AreEqual(13, listeTranches[1].Duree);
                    Assert.AreEqual(50, listeTranches[2].Priorite);
                    Assert.AreEqual(5, listeTranches[2].Duree);
                    Assert.AreEqual(10, listeTranches[3].Priorite);
                    Assert.AreEqual(4, listeTranches[3].Duree);
                }
            }
            finally
            {
                CTimosTestMetierApp.SessionClient.RollbackTrans();
            }
        }
        public void TestCalendrierQuatresTranchesAChevalSurDeuxJours()
        {
            try
            {
                CTimosTestMetierApp.SessionClient.BeginTrans();

                using (CContexteDonnee contexte = new CContexteDonnee(CTimosTestMetierApp.SessionClient.IdSession, true, false))
                {
                    // Création des tranches horaires
                    // Première tranche de Jour de 8h à 11 h
                    CHoraireJournalier_Tranche t1 = new CHoraireJournalier_Tranche(contexte);
                    t1.CreateNew();
                    t1.HoraireJournalier     = (CHoraireJournalier)GetEntite(typeof(CHoraireJournalier), m_nIdHoraireJournalier, contexte);
                    t1.TypeOccupationHoraire = (CTypeOccupationHoraire)GetEntite(typeof(CTypeOccupationHoraire), m_nIdOccupationJour, contexte);
                    t1.HeureDebut            = 8 * 60; // 8 heures
                    t1.HeureFin = 12 * 60;             // 11 heures
                    Assert.IsTrue(t1.CommitEdit().Result);

                    // Deuxième tranche de Repos de 12h à 14 h
                    CHoraireJournalier_Tranche t2 = new CHoraireJournalier_Tranche(contexte);
                    t2.CreateNew();
                    t2.HoraireJournalier     = (CHoraireJournalier)GetEntite(typeof(CHoraireJournalier), m_nIdHoraireJournalier, contexte);
                    t2.TypeOccupationHoraire = (CTypeOccupationHoraire)GetEntite(typeof(CTypeOccupationHoraire), m_nIdOccupationRepos, contexte);
                    t2.HeureDebut            = 12 * 60;
                    t2.HeureFin = 14 * 60;
                    Assert.IsTrue(t2.CommitEdit().Result);

                    // Troisième tranche de travail
                    CHoraireJournalier_Tranche t3 = new CHoraireJournalier_Tranche(contexte);
                    t3.CreateNew();
                    t3.HoraireJournalier     = (CHoraireJournalier)GetEntite(typeof(CHoraireJournalier), m_nIdHoraireJournalier, contexte);
                    t3.TypeOccupationHoraire = (CTypeOccupationHoraire)GetEntite(typeof(CTypeOccupationHoraire), m_nIdOccupationJour, contexte);
                    t3.HeureDebut            = 14 * 60;
                    t3.HeureFin = 19 * 60;
                    Assert.IsTrue(t3.CommitEdit().Result);

                    // Troisième tranche : astreinte
                    CHoraireJournalier_Tranche t4 = new CHoraireJournalier_Tranche(contexte);
                    t4.CreateNew();
                    t4.HoraireJournalier     = (CHoraireJournalier)GetEntite(typeof(CHoraireJournalier), m_nIdHoraireJournalier, contexte);
                    t4.TypeOccupationHoraire = (CTypeOccupationHoraire)GetEntite(typeof(CTypeOccupationHoraire), m_nIdOccupationAstreinte, contexte);
                    t4.HeureDebut            = 19 * 60; // de 19 heures
                    t4.HeureFin = 8 * 60;               // à 8 heures le lendemain
                    Assert.IsTrue(t4.CommitEdit().Result);

                    // On demande les Horaires à l'acteur de maintenant à demain même heure (24 heures)
                    CActeur           acteur        = (CActeur)GetEntite(typeof(CActeur), m_nIdActeur, contexte);
                    CTrancheHoraire[] listeTranches = acteur.GetHoraires(DateTime.Now.Date, DateTime.Now.Date.AddDays(1));

                    Assert.AreEqual(5, listeTranches.Length);
                    Assert.AreEqual(100, listeTranches[0].Priorite);
                    Assert.AreEqual(13, listeTranches[0].Duree);
                    Assert.AreEqual(100, listeTranches[1].Priorite);
                    Assert.AreEqual(13, listeTranches[1].Duree);
                    Assert.AreEqual(50, listeTranches[2].Priorite);
                    Assert.AreEqual(5, listeTranches[2].Duree);
                    Assert.AreEqual(50, listeTranches[3].Priorite);
                    Assert.AreEqual(4, listeTranches[3].Duree);
                    Assert.AreEqual(10, listeTranches[4].Priorite);
                    Assert.AreEqual(2, listeTranches[4].Duree);

                    // On demande les Horaires à l'acteur de 12H au landemain 12H
                    // -> attendu 6 tranches, car à 12H00 pile on comptabilise la tranche qui se termine à 12H et celle qui commence à 12H00
                    listeTranches = acteur.GetHoraires(DateTime.Today.AddHours(12), DateTime.Today.AddDays(1).AddHours(12));
                    Assert.AreEqual(6, listeTranches.Length);

                    // On demande les horaires aujourd'hui entre 13H et 16H -> attendu 2 tranches
                    listeTranches = acteur.GetHoraires(DateTime.Today.AddHours(13), DateTime.Today.AddHours(16));
                    Assert.AreEqual(2, listeTranches.Length);

                    // On demande les horaires aujourd'hui entre 13H et 23H -> attendu 3 tranches
                    listeTranches = acteur.GetHoraires(DateTime.Today.AddHours(13), DateTime.Today.AddHours(23));
                    Assert.AreEqual(3, listeTranches.Length);
                    // On demande les horaires entre aujourd'hui 13H et demain matin 01H00 -> attendu 3 tranches
                    listeTranches = acteur.GetHoraires(DateTime.Today.AddHours(13), DateTime.Today.AddDays(1).AddHours(1));
                    Assert.AreEqual(3, listeTranches.Length);
                }
            }
            finally
            {
                CTimosTestMetierApp.SessionClient.RollbackTrans();
            }
        }