public void TestIndexIsCalled() { EtudiantController contro = new EtudiantController(_stubMock); var resultat = contro.Index(); _stubMock.Received().GetAllEtudiant();// tester si Getdonnee a ete appele }
public void TestIndex() { EtudiantController contro = new EtudiantController(_stubMock); ViewResult r = contro.Index() as ViewResult; Assert.AreEqual("exo3.Controllers.EtudiantController", r.ViewData["ControllerName"]); Assert.AreEqual("Index", r.ViewName); Assert.IsNotNull(r.ViewData.Model); Assert.AreEqual(r.ViewData.Model, _stubMock.GetAllEtudiant()); // IsType<IEtudiantRepository>(r.ViewData.Model); // Assert.AreEqual( r.ViewData.Model,"Etudiant"); }