public void DIngredient_WhenAskedForKey_ReturnsEmail_ID() { //Arrange: An ingredient with a unique key is constructed. DIngredient ingredient = new DIngredient { Ingredient_ID = -1 }; //Act: the key is retrieved. int key = ingredient.key; //Assert: the key is the same as the friended user's ID. Assert.AreEqual(key, ingredient.Ingredient_ID); }
public void DIngredientWithSqlMembers_WhenScrubbed_BecomesSafe() { //Arrange: An ingredient with malicious html and sql members is constructed. string malicious = "1');DELETE TABLE dbo.example;--"; DIngredient ingredient = new DIngredient{ Long_Name = malicious }; //Act: The friended user is scrubbed. ingredient.Scrub(); //Assert: The friended user has no html in its members. Assert.AreNotEqual(malicious, ingredient.Long_Name); }
public void DIngredientWithHtmlMembers_WhenScrubbed_BecomesSafe() { //Arrange: An ingredient with malicious sql members is constructed. string malicious = "<div></div>"; DIngredient ingredient = new DIngredient{ Long_Name = malicious }; //Act: The friended user is scrubbed. ingredient.Scrub(); //Assert: The friended user has no html in its members. Assert.AreNotEqual(malicious, ingredient.Long_Name); }
public IEnumerable<DDrink> Ingredient_Update(DIngredient updating, string username) { IDataRepository<DDrink> drinks = RepositoryFactory.Instance.Construct<DDrink>(username); IDataRepository<DIngredient> ingredients; if((ingredients = drinks.FirstOrDefault(x => x.Drink_ID == updating.Drink_ID) .ingredients as IDataRepository<DIngredient>) != null){ //Drinks for ingredient does belong to given user. ingredients.Update(updating); } return drinks; }
public ActionResult Ingredient_Update(DIngredient updating) { return View("Index"); }
public ActionResult Ingredient_Delete(DIngredient deleting) { return View("Index"); }
public ActionResult Ingredient_Create(DIngredient creating) { return View("Index"); }