public void ChargeUneAnnonce(){ Annonce annonce = Helper.Annonce.CreateWithValues(); DetailAnnoncePresenter presenter = new DetailAnnoncePresenter(Vue, repository.Object); presenter.AfficheLeDétailDUneAnnonce(annonce); Assert.AreEqual(annonce.Titre, Vue.TitreAnnonce); Assert.AreEqual(annonce.Employeur, Vue.EmployeurAnnonce); Assert.AreEqual(annonce.DateParution, Vue.DateParutionAnnonce); Assert.AreEqual(annonce.Salaire, Vue.SalaireAnnonce); Assert.AreEqual(annonce.Description, Vue.DescriptionAnnonce); Assert.AreEqual(annonce.Experience, Vue.ExperienceAnnonce); Assert.AreEqual(annonce.TypeContrat, Vue.TypeContratAnnonce); Assert.AreEqual(annonce.Ville, Vue.VilleAnnonce); Assert.AreEqual(annonce.Tags, Vue.Tags); Assert.AreEqual(annonce.Favori, Vue.FavoriAnnonce); Assert.AreEqual(annonce, presenter.AnnonceEnCours); }
public void ChangeLEtatDeFavoriDUneAnnonce() { IDetailAnnonceView fake = new FakeDetailAnnonceVue(); Annonce annonce = Helper.Annonce.CreateWithValues(); repository.Setup(repo => repo.AjouteOuMetAJour(annonce)).Verifiable(); annonce.Favori = false; DetailAnnoncePresenter presenter = new DetailAnnoncePresenter(fake, repository.Object); presenter.AfficheLeDétailDUneAnnonce(annonce); presenter.AjouterAuxFavoris(null, null); Assert.AreEqual(true, annonce.Favori); Assert.AreEqual(fake.FavoriAnnonce, true); presenter.AjouterAuxFavoris(null, null); Assert.AreEqual(false, annonce.Favori); Assert.AreEqual(fake.FavoriAnnonce, false); repository.Verify(repo => repo.AjouteOuMetAJour(annonce), Times.Exactly(2)); }