public void VisOrdre_vis_View() { var SessionMock = new TestControllerBuilder(); var controller = new AdminController(new AdminBLL(new AdminRepositoryStub())); SessionMock.InitializeController(controller); controller.Session["AdminLoggetInn"] = true; var forventetResultat = new List<Bestilling>(); var ordre = new Bestilling() { BestillingsID = 100, KundeId = "sofia", BestillingsDato = new DateTime(2015, 11, 04, 08, 00, 00), Total = 10, }; forventetResultat.Add(ordre); forventetResultat.Add(ordre); forventetResultat.Add(ordre); //act var actionResult = (ViewResult)controller.VisOrdre(1); var resultat = (List<Bestilling>)actionResult.Model; //assert Assert.AreEqual(actionResult.ViewName, ""); for (var i = 0; i < resultat.Count; i++) { Assert.AreEqual(forventetResultat[i].BestillingsID, resultat[i].BestillingsID); Assert.AreEqual(forventetResultat[i].KundeId, resultat[i].KundeId); Assert.AreEqual(forventetResultat[i].BestillingsDato, resultat[i].BestillingsDato); Assert.AreEqual(forventetResultat[i].Total, resultat[i].Total); } }