public void TiersEstValide_TiersPrenomVide() { ITiersService tiersService = new TiersService(); Assert.AreEqual(false, tiersService.TiersEstValide(null, new Tiers() { Nom = "NomTiers", Prenom = string.Empty })); }
public TiersTests() { _limitsService = new Mock <ILimitsService>(); _settingsService = new Mock <ISettingsService>(); _tierUpgradeService = new Mock <ITierUpgradeService>(); _questionnaireService = new Mock <IQuestionnaireService>(); _tierService = new TiersService(_limitsService.Object, _settingsService.Object, _tierUpgradeService.Object, _questionnaireService.Object); }
public void TiersDejaEnBaseTestOk() { Mock <IUnitOfWork> mockUnitOfWork = new Mock <IUnitOfWork>(); mockUnitOfWork .Setup(x => x.Repository <Tiers>().Where(It.IsAny <Func <Tiers, bool> >(), null)) .Returns(new List <Tiers>() { }); // simule un retour d'une liste vide à la requete Where => donc il n'y a pas de doublon ITiersService tiersService = new TiersService(); Assert.AreEqual(false, tiersService.TiersDejaEnBase(mockUnitOfWork.Object, new Tiers() { Nom = "NomTiers", Prenom = "PrenomTiers" })); }
public void TiersDejaEnBaseTestPasOk() { Mock <IUnitOfWork> mockUnitOfWork = new Mock <IUnitOfWork>(); mockUnitOfWork .Setup(x => x.Repository <Tiers>().Where(It.IsAny <Func <Tiers, bool> >(), null)) // Quelque soit le Where le retour est le même .Returns(new List <Tiers>() { new Tiers() }); // simule le retour d'un tiers à la requete Where => donc il y a un doublon ITiersService tiersService = new TiersService(); Assert.AreEqual(true, tiersService.TiersDejaEnBase(mockUnitOfWork.Object, new Tiers() { Nom = "NomTiers", Prenom = "PrenomTiers" })); }
public void TiersEstValide_ServiceAdresseOk() { Mock <IUnitOfWork> mockUnitOfWork = new Mock <IUnitOfWork>(); mockUnitOfWork .Setup(x => x.Repository <Tiers>().Where(It.IsAny <Func <Tiers, bool> >(), null)) .Returns(new List <Tiers>() { }); Mock <IAdresseService> mockAdresseService = new Mock <IAdresseService>(); mockAdresseService .Setup(x => x.AdresseEstValide(It.IsAny <Adresse>())) .Returns(true); ITiersService tiersService = new TiersService(mockAdresseService.Object); Assert.AreEqual(true, tiersService.TiersEstValide(mockUnitOfWork.Object, new Tiers() { Nom = "NomTiers", Prenom = "PrenomTiers" })); }
public void TiersEstValide_TiersNull() { ITiersService tiersService = new TiersService(); Assert.AreEqual(false, tiersService.TiersEstValide(null, null)); }