public void visalleKunder_notadmin()
        {
            var mock = new Mock<ControllerContext>();

            mock.SetupGet(u => u.HttpContext.Request.IsAuthenticated).Returns(true);
            mock.SetupGet(u => u.HttpContext.User.Identity.Name).Returns("");
            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 = (RedirectToRouteResult)controller.visAlleKunder();

            Assert.AreEqual("logginn", viewResult.RouteValues["Action"]); //<---view som blir vist hvis er requested-->)
            Assert.AreEqual("Admin", viewResult.RouteValues["Controller"]); //<---view som blir vist hvis er requested-->)
        }
        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);
            }
        }