public void sokkunde_feil()
 {
     var liste = new List<User>();
     var kunde = new User()
         {
             Email = ""
         };
         liste.Add(kunde);
         liste.Add(kunde);
         liste.Add(kunde);
     var controller = new AdminController(new Mock<IAuth>().Object, new AdminLogikk(new ansattRepositoryStub()),
         new ProdukterLogikk(new ProduktRepositoryStub()), new KundeLogikk(new KundeRepositoryStub()));
     var k = (ViewResult)controller.SøkEtterKunde("", "");
     Assert.AreEqual(k.ViewName, "visAlleKunder");
     var resliste = (List<User>) k.Model;
     for(int i=0; i<resliste.Count;i++)
     {
         Assert.AreEqual(liste[i].Email, resliste[i].Email);
     }
 }
        public void visalleKunder_adminOK()
        {
            var mock = new Mock<ControllerContext>();

            mock.SetupGet(u => u.HttpContext.Request.IsAuthenticated).Returns(true);
            mock.SetupGet(u => u.HttpContext.User.Identity.Name).Returns("kj");

            var liste = new List<User>();
            var kunde = new User()
            {
                Email = "*****@*****.**",
                Firstname = "Arne",
                Lastname = "Hansen",
                PhoneNr = "22225555",
                Zipcode = "0001",

            };
            liste.Add(kunde);
            liste.Add(kunde);
            liste.Add(kunde);
            var controller = new AdminController(new Mock<IAuth>().Object, new AdminLogikk(new ansattRepositoryStub()),
                new ProdukterLogikk(new ProduktRepositoryStub()), new KundeLogikk(new KundeRepositoryStub()));
            controller.ControllerContext = mock.Object;
            var viewResult = (ViewResult)controller.visAlleKunder();
            var rikRes = (List<User>)viewResult.Model;
            Assert.IsTrue(viewResult.ViewData.Model == rikRes);
            for(int i = 0;i<rikRes.Count;i++)
            {
                Assert.AreEqual(liste[i].Email,rikRes[i].Email);
                Assert.AreEqual(liste[i].Firstname,rikRes[i].Firstname);
                Assert.AreEqual(liste[i].Lastname, rikRes[i].Lastname);
                Assert.AreEqual(liste[i].PhoneNr, rikRes[i].PhoneNr);
                Assert.AreEqual(liste[i].Zipcode, rikRes[i].Zipcode);
            }
        }
        public void soketterKunde_Ok()
        {
            var liste = new List<User>();
            var kunde = new User()
            {
                Email = "*****@*****.**",
                Firstname = "test",
                Lastname = "testern",
                PhoneNr = "12345678",
                Zipcode = "1274",
                Streetadress = "Gate 1"

            };
            liste.Add(kunde);
            liste.Add(kunde);
            liste.Add(kunde);
            var controller = new AdminController(new Mock<IAuth>().Object, new AdminLogikk(new ansattRepositoryStub()),
                new ProdukterLogikk(new ProduktRepositoryStub()), new KundeLogikk(new KundeRepositoryStub()));
            var k = (ViewResult)controller.SøkEtterKunde("epost","test");
            Assert.AreEqual(k.ViewName, "visAlleKunder");
            var resliste = (List<User>)k.Model;
            for (int i = 0; i < resliste.Count; i++)
            {
                Assert.AreEqual(liste[i].Email, resliste[i].Email);
                Assert.AreEqual(liste[i].Firstname, resliste[i].Firstname);
                Assert.AreEqual(liste[i].Lastname, resliste[i].Lastname);
                Assert.AreEqual(liste[i].PhoneNr, resliste[i].PhoneNr);
                Assert.AreEqual(liste[i].Zipcode, resliste[i].Zipcode);
                Assert.AreEqual(liste[i].Streetadress, resliste[i].Streetadress);
            }
        }