public void endreBestilling() { // Arrange var controller = new BestillingController(new BestillingBLL(new BestillingDALStub())); // Act //var actionResult = (ViewResult)controller.endreBestilling(1); // Assert //Assert.AreEqual(actionResult.ViewName, ""); }
public void Endre_funnet() { // Arrange var controller = new BestillingController(new BestillingBLL(new BestillingDALStub())); /*var innBestilling = new Bestilling() { BestillingID = 1, Total = 23, OrdreDato = DateTime.Now, Vare = new Vare() { Varenavn = "Eple", Pris = 12, Varebeholdning = 77 } }; // Act var actionResultat = (RedirectToRouteResult)controller.endreBestilling(1, innBestilling); // Assert Assert.AreEqual(actionResultat.RouteName, ""); Assert.AreEqual(actionResultat.RouteValues.Values.First(), "BestillingListe");*/ }
public void BestillingDetaljer() { var controller = new BestillingController(new BestillingBLL(new BestillingDALStub())); /*var forventetResultat = new Bestilling() { BestillingID = 1, Total = 23, OrdreDato = DateTime.Now, Vare = new Vare() { Varenavn = "Eple", Pris = 12, Varebeholdning = 77 } }; // Act var actionResult = (ViewResult)controller.BestillingDetaljer(1); var resultat = (Bestilling)actionResult.Model; // Assert Assert.AreEqual(actionResult.ViewName, ""); Assert.AreEqual(forventetResultat.BestillingID, resultat.BestillingID); Assert.AreEqual(forventetResultat.OrdreDato, resultat.OrdreDato); Assert.AreEqual(forventetResultat.Total, resultat.Total); Assert.AreEqual(forventetResultat.Vare, resultat.Vare);*/ }
public void Endre_ikke_funnet_Post() { // Arrange var controller = new BestillingController(new BestillingBLL(new BestillingDALStub())); /*var innBestilling = new Bestilling() { BestillingID = 1, Total = 23, OrdreDato = DateTime.Now, Vare = new Vare() { Varenavn = "Eple", Pris = 12, Varebeholdning = 77 } }; // Act var actionResult = (ViewResult)controller.endreBestilling(0, innBestilling); // Assert Assert.AreEqual(actionResult.ViewName, "");*/ }
public void slettBestilling() { var controller = new BestillingController(new BestillingBLL(new BestillingDALStub())); // Act /*var actionResult = (ViewResult)controller.slettBestilling(1); var resultat = (Bestilling)actionResult.Model; // Assert Assert.AreEqual(actionResult.ViewName, "");*/ }
public void Registrer_OK() { var controller = new BestillingController(new BestillingBLL(new BestillingDALStub())); /*var forventetBestilling = new Bestilling() { BestillingID = 1, Total = 23, OrdreDato = DateTime.Now, Vare = new Vare() { Varenavn = "Eple", Pris = 12, Varebeholdning = 77 } }; // Act var result = (RedirectToRouteResult)controller.RegistrerBestilling(forventetBestilling); // Assert Assert.AreEqual(result.RouteName, ""); Assert.AreEqual(result.RouteValues.Values.First(), "BestillingListe");*/ }
public void Registrer_feil_modell() { var controller = new BestillingController(new BestillingBLL(new BestillingDALStub())); var forventetBestilling = new Bestilling(); /*controller.ViewData.ModelState.AddModelError("Total", "Ikke oppgitt total"); // Act var actionResult = (ViewResult)controller.RegistrerBestilling(forventetBestilling); // Assert Assert.IsTrue(actionResult.ViewData.ModelState.Count == 1); Assert.AreEqual(actionResult.ViewName, "");*/ }
public void Registrer_feil_db() { var controller = new BestillingController(new BestillingBLL(new BestillingDALStub())); var forventetBestilling = new Bestilling(); /*forventetBestilling.Vare.Varenavn = ""; // Act var actionResult = (ViewResult)controller.RegistrerBestilling(forventetBestilling); // Assert Assert.AreEqual(actionResult.ViewName, "");*/ }
public void RegistrerBestilling() { var controller = new BestillingController(new BestillingBLL(new BestillingDALStub())); /*Bestilling bes = new Bestilling() { BestillingID = 1 }; var actionResult = (ViewResult)controller.RegistrerBestilling(1); Assert.AreEqual(actionResult.ViewName, "");*/ }
public void Liste() { var controller = new BestillingController(new BestillingBLL(new BestillingDALStub())); /*var forventetResultat = new List<Bestilling>(); var bestilling = new Bestilling() { BestillingID = 1, Total = 23, OrdreDato = DateTime.Now, Vare = new Vare() { Varenavn = "Eple", Pris = 12, Varebeholdning = 77 } }; forventetResultat.Add(bestilling); forventetResultat.Add(bestilling); forventetResultat.Add(bestilling); // Act var actionResult = (ViewResult)controller.BestillingListe(); var resultat = (List<Bestilling>)actionResult.Model; // Assert Assert.AreEqual(actionResult.ViewName, ""); for (var i = 0; i < resultat.Count; i++) { Assert.AreEqual(forventetResultat[i].BestillingID, resultat[i].BestillingID); Assert.AreEqual(forventetResultat[i].Total, resultat[i].Total); Assert.AreEqual(forventetResultat[i].OrdreDato, resultat[i].OrdreDato); Assert.AreEqual(forventetResultat[i].Vare, resultat[i].Vare); }*/ }
public void Endre_Ikke_Funnet_Ved_View() { // Arrange var controller = new BestillingController(new BestillingBLL(new BestillingDALStub())); // Act /*var actionResult = (ViewResult)controller.endreBestilling(0); var bestillingResultat = (Kunde)actionResult.Model; // Assert Assert.AreEqual(actionResult.ViewName, ""); Assert.AreEqual(bestillingResultat.ID, 0);*/ }