Ejemplo n.º 1
0
 public override bool Equals(System.Object otherDisease)
 {
     if (!(otherDisease is Disease))
     {
         return(false);
     }
     else
     {
         Disease newDisease          = (Disease)otherDisease;
         bool    idEquality          = (this.GetId() == newDisease.GetId());
         bool    nameEquality        = (this.GetName() == newDisease.GetName());
         bool    symtomsEquality     = (this.GetSymtoms() == newDisease.GetSymtoms());
         bool    imageEquality       = (this.GetImage() == newDisease.GetImage());
         bool    category_idEquality = (this.GetCategoryId() == newDisease.GetCategoryId());
         return(idEquality && nameEquality && imageEquality && symtomsEquality && category_idEquality);
     }
 }
Ejemplo n.º 2
0
        public void Test_Update_UpdatesDiseaseInDatabase()
        {
            //Arrange
            Disease testDisease = new Disease("cold", "running nose", "image1", 1);

            testDisease.Save();
            string newName       = "fever";
            string newSymtoms    = "Very hot";
            string newImage      = "image2";
            int    newCategoryId = 2;

            //Act
            testDisease.Update("fever", "Very hot", "image2", 2);
            string result1 = testDisease.GetName();
            string result2 = testDisease.GetSymtoms();
            string result3 = testDisease.GetImage();
            int    result4 = testDisease.GetCategoryId();

            //Assert
            Assert.Equal(newName, result1);
            Assert.Equal(newSymtoms, result2);
            Assert.Equal(newImage, result3);
            Assert.Equal(newCategoryId, result4);
        }