public void SalaireCadrePositif(int salaire) { var fauxDataEmploye = new Mock <IDataEmploye>(); fauxDataEmploye.Setup(x => x.EnregistrerCadre(It.IsAny <Cadre>())); var serviceEmploye = new ServiceEmploye(fauxDataEmploye.Object); var cadre = new Cadre { Nom = "Marty", Prenom = "McFly", DateEmbauche = DateTime.Today, SalaireMensuel = salaire }; var exception = Assert.ThrowsException <BusinessException>(() => { serviceEmploye.EnregistrerCadre(cadre); serviceEmploye.GetSalaireCadre(1, DateTime.Parse("01/08/2018")); }); Assert.AreEqual("Salaire mensuel invalide", exception.Message); }