Ejemplo n.º 1
0
        public void AddandDeleteTest()
        {
            List<Company> expected = Companies();
            Company company = new Company()
            {
                CVR = 68598712,
                Name = "Wild hairy",
                Id = 7,
                ImageUrl = "https://stocklogos-pd.s3.amazonaws.com/styles/logo-medium-alt/logos/image/cb5719494a08e764c8e051cac90065d9.png?itok=kjyW4wJl",
                Address = "Spangsbjerg Kirkevej 100 A",
                WebSite = "www.Wildhair.dk",
                Tel = "+41626289",
                OpenHours = "8-7",
                MinPrice = 150,
                MaxPrice = 500,
                Description = "Dedicaded hair salon for the wildness in your hair.",
                Category = category8,
                Ratings = new List<Rating>() { rating11, rating12 },
                Reviews = new List<Review>() { rev6 },
                Tags = new List<Tag>() { tag3, tag4 },
                NrRate = 2,
                Badges = new List<Badge> { }
            };

            expected.Add(company);
            repo.Add(company);
            List<Company> actual = repo.ReadAll();
            Company actuall = actual.Last();
            Assert.IsTrue(comparer(company, actuall));

            repo.Delete(company.Id);
            expected.Remove(company);

            Assert.IsTrue(listcomparer(repo.ReadAll(), expected));
        }
Ejemplo n.º 2
0
        public void FindTest()
        {
            Company expected = new Company();
            companies = Companies();
            foreach (var item in companies)
            {
                if (item.Id == 1)
                {
                     expected = item;
                }

            }
            Company actual = repo.Find(1);

            Assert.IsTrue(comparer(expected, actual));
        }
Ejemplo n.º 3
0
 public void PutCompany(int id, Company company)
 {
     company.Id = id;
     facade.GetCompanyRepository().Edit(company);
 }
Ejemplo n.º 4
0
 public bool comparer(Company a, Company b)
 {
     if(a.Name == b.Name && a.Id == b.Id)
     {
         return true;
     }
     return false;
 }
Ejemplo n.º 5
0
 public void PostCompany(Company company)
 {
     facade.GetCompanyRepository().Add(company);
 }