コード例 #1
0
 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);
     }
 }
コード例 #2
0
        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);
            }
        }