コード例 #1
0
		public void InitialisationDuPresenter()
		{
            FakeDetailAnnonceVue vue = new FakeDetailAnnonceVue();
            DetailAnnoncePresenter presenter = new DetailAnnoncePresenter(vue, repository.Object);

            Assert.AreEqual(vue, presenter.Vue);
		}
コード例 #2
0
        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));
            
        }
コード例 #3
0
        public void Initialize()
        {
            Vue = new FakeDetailAnnonceVue();
			Repository = new Mock<IAnnonceRepository>();
        }