コード例 #1
0
 public void seOrdrerLinjeTilKundeTomMail()
 {
     var forventet = new List<OrderLine>();
     var forventetord = new OrderLine();
     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.seOrdreLinjeTilKundeOrdre(0, null);
     var resliste = (List<OrderLine>)t.Model;
     Assert.AreEqual("_OrderLinePartial", t.ViewName);
     for (int i = 0; i < resliste.Count; i++)
     {
         Assert.AreEqual(forventet[i].Ordernumber, resliste[i].Ordernumber);
     }
 }
コード例 #2
0
        public void seOrdrerLinjeTilKunde()
        {
            var forventet = new List<OrderLine>();
            var order = new OrderLine()
            {
                Priceperunit = 100,
                Quantity = 1,
                Productid = 1,
                Ordernumber = 1,
                Product = new Product()
                {
                    Title = "TestVare"
                },
                Order = new Order()
                {
                    status = "teststatus",
                    statusDato = 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.seOrdreLinjeTilKundeOrdre(1,"*****@*****.**");
            var resliste = (List<OrderLine>)t.Model;
            Assert.AreEqual("_OrderLinePartial", t.ViewName);
            for (int i = 0; i < resliste.Count; i++)
            {
                Assert.AreEqual(forventet[i].Priceperunit, resliste[i].Priceperunit);
                Assert.AreEqual(forventet[i].Quantity, resliste[i].Quantity);
                Assert.AreEqual(forventet[i].Ordernumber, resliste[i].Ordernumber);
                Assert.AreEqual(forventet[i].Product.Title, resliste[i].Product.Title);
                Assert.AreEqual(forventet[i].Order.status, resliste[i].Order.status);
                Assert.AreEqual(forventet[i].Order.statusDato, resliste[i].Order.statusDato);
            }
        }