public void DELETE_GivenAnExistingIngredient_DeleteTheIngredient() { //Arrange Ingredient existingIngredient = new Ingredient { Id = 11, CreateDateTime = DateTime.Now, CreatedByAuthor = "Jane Doe", IsNut = true, MainIngredient = false, ModifiedDateTime = DateTime.Now, Name = "Almond" }; //Act var result = repository.Delete<Ingredient>(existingIngredient); repository.Commit(); //Assert Assert.IsInstanceOfType(result, typeof(int)); }
public void ADD_GivenAnIngredient_WhenAnIngredientIsAddedItIsAddedToTheDatabase() { //Arrange Ingredient newIngredient = new Ingredient { CreateDateTime = DateTime.Now, CreatedByAuthor = "Jane Doe", IsNut = true, MainIngredient = false, ModifiedDateTime = DateTime.Now, Name = "Almond" }; //Act Ingredient result = repository.Add<Ingredient>(newIngredient); repository.Commit(); //Assert Assert.IsNotNull(result.Id>0); Assert.IsInstanceOfType(result, typeof(Ingredient)); }
public void UPDATE_GivenAnExistingIngredient_UpdateTheName() { //Arrange Ingredient existingIngredient = new Ingredient { Id = 12, CreateDateTime = DateTime.Now, CreatedByAuthor = "Jane Doe", IsNut = true, MainIngredient = false, ModifiedDateTime = DateTime.Now, Name = "Cucumber" }; //Act Ingredient result = repository.Update<Ingredient>(existingIngredient); repository.Commit();//NB tried AsyncCommit with this but did not update!! //Assert Assert.IsInstanceOfType(result, typeof(Ingredient)); Assert.IsTrue(result.Name == existingIngredient.Name); }