public void Dish_getall_includes_ingredients_test() { Facade facade = new Facade(); Ingredient ing = new Ingredient() { Name = "ing1", Price = 200 }; Ingredient ing2 = new Ingredient() { Name = "ing2", Price = 200 }; ing = facade.IngredientRepo().Add(ing); ing2 = facade.IngredientRepo().Add(ing2); List<Ingredient> list = new List<Ingredient>(); list.Add(ing); list.Add(ing2); facade = new Facade(); Dish dish = new Dish() { Description = "asd", Ingredients = list, Name = "dish1", Status = 0 }; dish = facade.DishRepo().Add(dish); facade = new Facade(); Assert.AreEqual(facade.DishRepo().GetAll().ToList().FirstOrDefault(x => x.Id == dish.Id).Ingredients.Count, 2); }
public void Menu_add_throws_exception_on_updated_dish_test() { Facade facade = new Facade(); Ingredient ing1 = new Ingredient() { Name = "ing1", Price = 10 }; Ingredient ing2 = new Ingredient() { Name = "ing2", Price = 12 }; Ingredient ing3 = new Ingredient() { Name = "ing3", Price = 13 }; Ingredient ing4 = new Ingredient() { Name = "ing4", Price = 15 }; ing1 = facade.IngredientRepo().Add(ing1); ing2 = facade.IngredientRepo().Add(ing2); ing3 = facade.IngredientRepo().Add(ing3); ing4 = facade.IngredientRepo().Add(ing4); Dish dish1 = new Dish() { Description = "descrip 1", Name = "dish1", Status = 0, Ingredients = new List<Ingredient>() { ing1, ing2 } }; Dish dish2 = new Dish() { Description = "descrip 2", Name = "dish2", Status = 1, Ingredients = new List<Ingredient>() { ing3, ing4 } }; Dish dish3 = new Dish() { Description = "descrip 3", Name = "dish3", Status = 3, Ingredients = new List<Ingredient>() { ing1, ing2, ing3, ing4 } }; dish1 = facade.DishRepo().Add(dish1); dish2 = facade.DishRepo().Add(dish2); dish3 = facade.DishRepo().Add(dish3); dish1.Name = "changed"; Menu menu = new Menu() { Dishes = new List<Dish> { dish1, dish2, dish3 }, Name = "menu1" }; menu = facade.MenuRepo().Add(menu); }
public void Dish_add_throws_exception_on_updated_ingredient_test() { Facade facade = new Facade(); Ingredient ing2 = new Ingredient() { Name = "ing2", Price = 200 }; ing2 = facade.IngredientRepo().Add(ing2); ing2.Name = "Changed"; List<Ingredient> list = new List<Ingredient>(); list.Add(ing2); facade = new Facade(); Dish dish = new Dish() { Description = "asd", Ingredients = list, Name = "dish1", Status = 0 }; dish = facade.DishRepo().Add(dish); }
public void Party_add_throws_exception_on_new_customer_test() { Facade facade = new Facade(); Party par = MakeParty(); par.Customer = new Customer(); facade.PartyRepo().Add(par); }
public void Party_add_throws_exception_on_new_address_test() { Facade facade = new Facade(); Party par = MakeParty(); par.Address = new Address(); facade.PartyRepo().Add(par); }
public Menu MakeMenu() { Facade facade = new Facade(); Ingredient ing1 = new Ingredient() { Name = "ing1", Price = 10 }; Ingredient ing2 = new Ingredient() { Name = "ing2", Price = 12 }; Ingredient ing3 = new Ingredient() { Name = "ing3", Price = 13 }; Ingredient ing4 = new Ingredient() { Name = "ing4", Price = 15 }; ing1 = facade.IngredientRepo().Add(ing1); ing2 = facade.IngredientRepo().Add(ing2); ing3 = facade.IngredientRepo().Add(ing3); ing4 = facade.IngredientRepo().Add(ing4); Dish dish1 = new Dish() { Description = "descrip 1", Name = "dish1", Status = 0, Ingredients = new List<Ingredient>() { ing1, ing2 } }; Dish dish2 = new Dish() { Description = "descrip 2", Name = "dish2", Status = 1, Ingredients = new List<Ingredient>() { ing3, ing4 } }; Dish dish3 = new Dish() { Description = "descrip 3", Name = "dish3", Status = 3, Ingredients = new List<Ingredient>() {ing1, ing2, ing3, ing4 } }; dish1 = facade.DishRepo().Add(dish1); dish2 = facade.DishRepo().Add(dish2); dish3 = facade.DishRepo().Add(dish3); Menu menu = new Menu() { Dishes = new List<Dish> { dish1, dish2, dish3 }, Name = "menu1" }; menu = facade.MenuRepo().Add(menu); return menu; }
public void Dish_add_using_new_ingredient_throws_exception_test() { Facade facade = new Facade(); Dish dish = new Dish() { Description = "asd", Name = "asd", Status = 1, Ingredients = new List<Ingredient>() { new Ingredient() { Name = "123", Price = 123 } } }; facade.DishRepo().Add(dish); }
public void Ingredient_adds_on_call_test() { Facade facade = new Facade(); Ingredient ing = new Ingredient() { Name = "hestkød", Price = 200 }; ing = facade.IngredientRepo().Add(ing); facade = new Facade(); Assert.AreEqual(facade.IngredientRepo().Get(ing.Id).Name, ing.Name); }
public void Address_adds_on_call_test() { Facade facade = new Facade(); Address add = new Address() { Country = "asd", StreetAddress = "asd", ZipCode ="1234" }; add = facade.AddressRepo().Add(add); facade = new Facade(); Assert.AreEqual(facade.AddressRepo().Get(add.Id).Country, add.Country); }
public void Ingredient_get_returns_all_values_correctly_test() { Facade facade = new Facade(); Ingredient ing = new Ingredient() { Name = "hestkød", Price = 200 }; ing = facade.IngredientRepo().Add(ing); facade = new Facade(); Assert.AreEqual(facade.IngredientRepo().Get(ing.Id).Name, ing.Name); Assert.AreEqual(facade.IngredientRepo().Get(ing.Id).Price, ing.Price); }
public void Ingredient_getall_returns_multiple_test() { Facade facade = new Facade(); Ingredient ing = new Ingredient() { Name = "hestkød", Price = 200 }; facade.IngredientRepo().Add(ing); ing = facade.IngredientRepo().Add(ing); facade = new Facade(); Assert.GreaterOrEqual(facade.IngredientRepo().GetAll().ToList().Count, 2); }
public void Customer_add_multiple_customer_same_address_test() { Facade facade = new Facade(); Customer cus = MakeCustomer(); Customer cus2 = new Customer() { Address = cus.Address, Email = "*****@*****.**", FirstName = "Jonas", LastName = "Olesen", PhoneNumber = "22342312" }; facade.CustomerRepo().Add(cus2); cus = facade.CustomerRepo().Add(cus); Assert.IsTrue(facade.CustomerRepo().Get(cus.Id).Address.Equals(facade.CustomerRepo().Get(cus2.Id).Address)); }
public Party MakeParty() { Facade facade = new Facade(); Ingredient ing1 = new Ingredient() { Name = "ing1", Price = 10 }; Ingredient ing2 = new Ingredient() { Name = "ing2", Price = 12 }; Ingredient ing3 = new Ingredient() { Name = "ing3", Price = 13 }; Ingredient ing4 = new Ingredient() { Name = "ing4", Price = 15 }; ing1 = facade.IngredientRepo().Add(ing1); ing2 = facade.IngredientRepo().Add(ing2); ing3 = facade.IngredientRepo().Add(ing3); ing4 = facade.IngredientRepo().Add(ing4); Dish dish1 = new Dish() { Description = "descrip 1", Name = "dish1", Status = 0, Ingredients = new List<Ingredient>() { ing1, ing2 } }; Dish dish2 = new Dish() { Description = "descrip 2", Name = "dish2", Status = 1, Ingredients = new List<Ingredient>() { ing3, ing4 } }; Dish dish3 = new Dish() { Description = "descrip 3", Name = "dish3", Status = 3, Ingredients = new List<Ingredient>() { ing1, ing2, ing3, ing4 } }; dish1 = facade.DishRepo().Add(dish1); dish2 = facade.DishRepo().Add(dish2); dish3 = facade.DishRepo().Add(dish3); Menu menu = new Menu() { Dishes = new List<Dish> { dish1, dish2, dish3 }, Name = "menu1" }; Menu menu2 = new Menu() { Dishes = new List<Dish> { dish1, dish2 }, Name = "menu2" }; menu = facade.MenuRepo().Add(menu); menu2 = facade.MenuRepo().Add(menu2); Address address = new Address() { Country = "Denmark", StreetAddress = "Møbelvej 3", ZipCode = "6800" }; Address address2 = new Address() { Country = "Denmark", StreetAddress = "gyvelunden 3", ZipCode = "6800" }; address = facade.AddressRepo().Add(address); address2 = facade.AddressRepo().Add(address2); Customer cus = new Customer(){Address = address, Email = "*****@*****.**",FirstName = "Jonas",LastName = "Olesen",PhoneNumber = "22342312"}; cus = facade.CustomerRepo().Add(cus); Party party = new Party() { Address = address2, Customer = cus, CreationDate = DateTime.Now.AddYears(-2), Description = "Description", FestNummer = "1", Menus = new List<Menu>() { menu, menu2 }, UseDate = DateTime.Now.AddMonths(-1) }; party = facade.PartyRepo().Add(party); return party; }
public void Address_getall_returns_multiple_test() { Facade facade = new Facade(); Address add = new Address() { Country = "asd", StreetAddress = "asd", ZipCode = "1234" }; add = facade.AddressRepo().Add(add); facade.AddressRepo().Add(add); add = facade.AddressRepo().Add(add); facade = new Facade(); Assert.GreaterOrEqual(facade.AddressRepo().GetAll().ToList().Count, 2); }
public void Ingredient_remove_removes_right_one_test() { Facade facade = new Facade(); Ingredient ing = new Ingredient() { Name = "hestkød", Price = 200 }; ing = facade.IngredientRepo().Add(ing); facade = new Facade(); facade.IngredientRepo().Remove(ing.Id); facade = new Facade(); Assert.IsNull(facade.IngredientRepo().Get(ing.Id)); }
public void Address_get_returns_all_values_correctly_test() { Facade facade = new Facade(); Address add = new Address() { Country = "asd", StreetAddress = "asd", ZipCode = "1234" }; add = facade.AddressRepo().Add(add); facade = new Facade(); Assert.AreEqual(facade.AddressRepo().Get(add.Id).Country, add.Country); Assert.AreEqual(facade.AddressRepo().Get(add.Id).StreetAddress, add.StreetAddress); Assert.AreEqual(facade.AddressRepo().Get(add.Id).ZipCode, add.ZipCode); }
public void Address_remove_removes_right_one_test() { Facade facade = new Facade(); Address add = new Address() { Country = "asd", StreetAddress = "asd", ZipCode = "1234" }; add = facade.AddressRepo().Add(add); facade = new Facade(); facade.AddressRepo().Remove(add.Id); facade = new Facade(); Assert.IsNull(facade.AddressRepo().Get(add.Id)); }
public void Customer_add_throws_exception_on_new_customer_test() { Facade facade = new Facade(); Address address = new Address() { Country = "Denmark", StreetAddress = "Møbelvej 3", ZipCode = "6800" }; Customer cus = new Customer() { Address = address, Email = "*****@*****.**", FirstName = "Jonas", LastName = "Olesen", PhoneNumber = "22342312" }; cus = facade.CustomerRepo().Add(cus); }
public Customer MakeCustomer() { Facade facade = new Facade(); Address address = new Address() { Country = "Denmark", StreetAddress = "Møbelvej 3", ZipCode = "6800" }; address = facade.AddressRepo().Add(address); Customer cus = new Customer() { Address = address, Email = "*****@*****.**", FirstName = "Jonas", LastName = "Olesen", PhoneNumber = "22342312" }; cus = facade.CustomerRepo().Add(cus); return cus; }
public void Customer_update_updates_properties_test() { Customer cus = MakeCustomer(); Facade facade = new Facade(); cus.Email = "*****@*****.**"; cus.FirstName = "changed"; cus.LastName = "lastname"; cus.PhoneNumber = "22755692"; Assert.IsTrue(facade.CustomerRepo().Update(cus)); Assert.IsTrue(facade.CustomerRepo().Get(cus.Id).Equals(cus)); }
public void Customer_update_updates_address_test() { Facade facade = new Facade(); Customer cus = MakeCustomer(); Address address = new Address() { Country = "Denmark2", StreetAddress = "Møbelvej 32", ZipCode = "68002" }; address = facade.AddressRepo().Add(address); cus.Address = address; facade.CustomerRepo().Update(cus); Assert.IsTrue(address.Equals(facade.CustomerRepo().Get(cus.Id).Address)); }
public void Customer_update_throws_exception_on_customer_null_test() { Facade facade = new Facade(); facade.CustomerRepo().Update(null); }
public void Customer_update_throws_exception_on_customer_address_updated_test() { Facade facade = new Facade(); Customer cus = MakeCustomer(); cus.Address.StreetAddress = "changed"; facade.CustomerRepo().Update(cus); }
public void Customer_update_throws_exception_on_customer_address_new_test() { Facade facade = new Facade(); Customer cus = MakeCustomer(); cus.Address = new Address(); facade.CustomerRepo().Update(cus); }
public void Customer_update_returns_false_on_none_existing_customer_test() { Facade facade = new Facade(); Assert.IsFalse(facade.CustomerRepo().Update(new Customer())); }
public void Customer_remove_throws_exception_on_customer_none_existing_test() { Facade facade = new Facade(); facade.CustomerRepo().Remove(-1); }
public void Customer_remove_removes_from_db_test() { Customer cus = MakeCustomer(); Facade facade = new Facade(); facade.CustomerRepo().Remove(cus.Id); Assert.IsNull(facade.CustomerRepo().Get(cus.Id)); }
public void Customer_add_throws_exception_on_null_address_test() { Facade facade = new Facade(); facade.CustomerRepo().Add(null); }
public void Customer_add_uses_existing_customer_test() { Facade facade = new Facade(); Address address = new Address() { Country = "Denmark", StreetAddress = "Møbelvej 3", ZipCode = "6800" }; address = facade.AddressRepo().Add(address); Customer cus = new Customer() { Address = address, Email = "*****@*****.**", FirstName = "Jonas", LastName = "Olesen", PhoneNumber = "22342312" }; cus = facade.CustomerRepo().Add(cus); Assert.IsTrue(facade.CustomerRepo().Get(cus.Id).Address.Equals(address)); }
public void Customer_remove_does_not_remove_address_test() { Customer cus = MakeCustomer(); Facade facade = new Facade(); facade.CustomerRepo().Remove(cus.Id); Assert.IsNotNull(facade.AddressRepo().Get(cus.Address.Id)); }