public void seOrdrerTilKundeTomMail() { var forventet = new List<Order>(); var forventetord = new Order(); forventetord.Ordernumber = 0; forventet.Add(forventetord); forventet.Add(forventetord); forventet.Add(forventetord); var controller = new AdminController(new Mock<IAuth>().Object, new AdminLogikk(new ansattRepositoryStub()), new ProdukterLogikk(new ProduktRepositoryStub()), new KundeLogikk(new KundeRepositoryStub())); var t =controller.seOrdrerTilKunde(null); var resliste = (List<Order>)t.Model; Assert.AreEqual("_OrdersPartiall",t.ViewName); for (int i = 0; i < resliste.Count; i++) { Assert.AreEqual(forventet[i].Ordernumber, resliste[i].Ordernumber); } }
public void seOrdrerTilKunde() { var forventet = new List<Order>(); var order = new Order() { Confirmed = true, Email = "*****@*****.**", Ordernumber = 1, dato = DateTime.Today }; forventet.Add(order); forventet.Add(order); forventet.Add(order); var controller = new AdminController(new Mock<IAuth>().Object, new AdminLogikk(new ansattRepositoryStub()), new ProdukterLogikk(new ProduktRepositoryStub()), new KundeLogikk(new KundeRepositoryStub())); var t = controller.seOrdrerTilKunde("*****@*****.**"); var resliste = (List<Order>)t.Model; Assert.AreEqual("_OrdersPartiall", t.ViewName); for (int i = 0; i < resliste.Count; i++) { Assert.AreEqual(forventet[i].Confirmed, resliste[i].Confirmed); Assert.AreEqual(forventet[i].Email, resliste[i].Email); Assert.AreEqual(forventet[i].Ordernumber, resliste[i].Ordernumber); Assert.AreEqual(forventet[i].dato, resliste[i].dato); } }