Beispiel #1
0
        public void __127_CacherJourDeLAnnée()
        {
            Date dateConst = new DateConstante(2000, 12, 31);

            for (int i = 0; i < 100000; i++)
            {
                AreEqual(366, dateConst.JourDeLAnnée);
            }
        }
Beispiel #2
0
        public void __126_ClonageDateConstante()
        {
            Date date       = new Date(2001, 9, 11);
            Date dateConst  = new DateConstante(2001, 9, 11);
            Date cloneConst = dateConst.Cloner(1999, 8);

            AreEqual("Date", date.Cloner().GetType().Name);
            AreEqual("DateConstante", cloneConst.GetType().Name);
            AreEqual("1999-08-11", cloneConst.ToString());
            ThrowsException <ArgumentOutOfRangeException>(() => dateConst.Cloner(1999, 2, 31));
        }
        public void __125_DateConstante()
        {
            Date dateConst = new DateConstante(2001, 9, 11);

            ThrowsException <DateConstanteException>(() => dateConst.Année        = 2000);
            ThrowsException <DateConstanteException>(() => dateConst.Mois         = 10);
            ThrowsException <DateConstanteException>(() => dateConst.MoisTypé     = Mois.Août);
            ThrowsException <DateConstanteException>(() => dateConst.Jour         = 5);
            ThrowsException <DateConstanteException>(() => dateConst.JourDeLAnnée = 155);
            ThrowsException <DateConstanteException>(() => dateConst.Incrémenter());
            ThrowsException <DateConstanteException>(() => dateConst.Décrémenter());
            ThrowsException <DateConstanteException>(() => dateConst.MettreÀJour());
            IsTrue(DateUtil.DateAttentatWTC is DateConstante);
            IsTrue(DateUtil.DateDécèsMJ is DateConstante);
            IsTrue(DateUtil.DateExplosionNC is DateConstante);
        }
        static void Main(string[] args)
        {
            Title = "Afficher Date Constante";

            var dateConst = new DateConstante(2001, 9, 11);

            Afficher("        ToString", dateConst);
            Afficher("     EnTexteLong", $"{dateConst:L}");
            Afficher("    JourDeLAnnée", dateConst.JourDeLAnnée);
            Afficher(" JourDeLaSemaine", dateConst.JourDeLaSemaine);
            //dateConst.Incrémenter(365);
            //Afficher("  1 an plus tard", dateConst);
            //dateConst.Décrémenter(365);
            //Afficher("1 an plus tôt", dateConst);
            //dateConst.Mois--;
            //Afficher(" 1 mois plus tôt", dateConst);
            //dateConst.Jour--;
            //Afficher(" 1 jour plus tôt", dateConst);
            WriteLine();
            Afficher("       Cloner OK", dateConst.Cloner() is DateConstante);
            Afficher("    Dupliquer OK", dateConst.Dupliquer() is DateConstante);
        }