public void Test_Update_UpdatesRemedyInDatabase() { //Arrange Remedy testRemedy = new Remedy("Herbal", "descriptionHerbal", "sideEffectHerbal", "website.com/photoOfRemedy.jpg", 1); testRemedy.Save(); string newName = "Physical"; string newDescription = "fun"; string newSideEffect = "drowsy"; string newImage = "image2"; int newCategoryId = 2; //Act testRemedy.Update(newName, newDescription, newSideEffect, newImage, newCategoryId); string result1 = testRemedy.GetName(); string result2 = testRemedy.GetDescription(); string result3 = testRemedy.GetSideEffect(); string result4 = testRemedy.GetImage(); int result5 = testRemedy.GetCategoryId(); //Assert Assert.Equal(newName, result1); Assert.Equal(newDescription, result2); Assert.Equal(newSideEffect, result3); Assert.Equal(newImage, result4); Assert.Equal(newCategoryId, result5); }
public override bool Equals(System.Object otherRemedy) { if (!(otherRemedy is Remedy)) { return(false); } else { Remedy newRemedy = (Remedy)otherRemedy; bool idEquality = this.GetId() == newRemedy.GetId(); bool nameEquality = this.GetName() == newRemedy.GetName(); bool descriptionEquality = this.GetDescription() == newRemedy.GetDescription(); bool sideEffect = this.GetSideEffect() == newRemedy.GetSideEffect(); bool imageEquality = this.GetImage() == newRemedy.GetImage(); bool categoryIdEquality = this.GetCategoryId() == newRemedy.GetCategoryId(); return(idEquality && nameEquality && descriptionEquality && sideEffect && imageEquality && categoryIdEquality); } }