Esempio n. 1
0
        public void DeleteTax()
        {
            Tax toDelete = ctx.TaxSet.FirstOrDefault(p => p.Title == "Tax1");

            repo.Delete(toDelete);
            repo.Save();

            Assert.IsNull(repo.GetTaxById(toDelete.Id, (int)ctx.HomeSet.FirstOrDefault(p => p.Title == "LaCorderie").ClientId));
            Assert.IsNotNull(ctx.TaxSet.FirstOrDefault(p => p.Title == "Tax2"));

            Assert.AreEqual(0, ctx.ProductSet.Where(p => p.Tax.Id == toDelete.Id).ToList().Count);

            Assert.AreEqual(0, ctx.RoomSupplementSet.Include("Tax").Where(p => p.Tax.Id == toDelete.Id).ToList().Count);

            Assert.AreEqual(0, ctx.MealPriceSet.Include("Tax").Where(p => p.Tax.Id == toDelete.Id).ToList().Count);

            Assert.AreEqual(0, ctx.PeopleCategorySet.Include("Tax").Where(p => p.Tax.Id == toDelete.Id).ToList().Count);

            Assert.AreEqual(0, ctx.PricePerPersonSet.Include("Tax").Where(p => p.Tax.Id == toDelete.Id).ToList().Count);
        }