コード例 #1
0
        public void ValiderNombreJoursTravaillés()
        {
            var fauxDataEmploye = new Mock <IDataEmploye>();
            var fauxDataReleve  = new Mock <IDataReleve>();

            fauxDataEmploye.Setup(x => x.GetOuvrier(It.IsAny <int>())).Returns(new Ouvrier());

            var           serviceReleve = new ServiceReleve(fauxDataReleve.Object, fauxDataEmploye.Object);
            ReleveMensuel releveMensuel = new ReleveMensuel();

            releveMensuel.Jours.Add(new ReleveJour
            {
                Jour         = DateTime.Now,
                NombreHeures = 15
            });

            //serviceReleve.EnregistrerReleveMensuel(releveMensuel);
            var exception = Assert.ThrowsException <BusinessException>(() =>
            {
                serviceReleve.EnregistrerReleveMensuel(releveMensuel);
            });

            Assert.AreEqual("Vous avez dépassé la limite horraire journalière",
                            exception.Message);
        }
コード例 #2
0
        public void ValiderHoraire(string rawHoraire)
        {
            var fauxDataReleve  = new Mock <IDataReleve>();
            var fauxDataEmploye = new Mock <IDataEmploye>();
            var NombreHeures    = decimal.Parse(rawHoraire);
            var serviceReleve   = new ServiceReleve(fauxDataReleve.Object, fauxDataEmploye.Object);
            var releveMensuel   = new ReleveMensuel();

            var exception = Assert.ThrowsException <BusinessException>(() =>
            {
                var releveJour = new ReleveJour
                {
                    Jour         = new DateTime(2018, 05, 10),
                    NombreHeures = 20
                };
                releveMensuel.Jours.Add(releveJour);
                serviceReleve.EnregistrerReleveMensuel(releveMensuel);
            });

            Assert.AreEqual("Le nombre d'heure doit etre compris entre 1 et 13", exception.Message);
        }