示例#1
0
 public override bool Equals(System.Object otherRestaurant)
 {
     if (!(otherRestaurant is Restaurant))
     {
         return(false);
     }
     else
     {
         Restaurant newRestaurant       = (Restaurant)otherRestaurant;
         bool       idEquality          = (this.GetId() == newRestaurant.GetId());
         bool       descriptionEquality = (this.GetDescription() == newRestaurant.GetDescription());
         bool       cuisineEquality     = this.GetCuisineId() == newRestaurant.GetCuisineId();
         bool       addressEquality     = this.GetAddress() == newRestaurant.GetAddress();
         return(idEquality && descriptionEquality && cuisineEquality && addressEquality);
     }
 }
示例#2
0
        public void Test_Update_UpdatesRestaurantInDatabase()
        {
            //Arrange
            string     name           = "Fart Berry";
            Restaurant testRestaurant = new Restaurant(name, 1, "123 example st", "555-555-5555");

            testRestaurant.Save();
            string newName = "Tart Berry";

            //Act
            testRestaurant.Update(newName);

            string result = testRestaurant.GetDescription();

            //Assert
            Assert.Equal(newName, result);
        }