示例#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       nameEquality       = (this.GetName() == newRestaurant.GetName());
         bool       styleEquality      = (this.GetStyle() == newRestaurant.GetStyle());
         bool       cuisine_idEquality = (this.GetCuisineId() == newRestaurant.GetCuisineId());
         return(idEquality && nameEquality && styleEquality && cuisine_idEquality);
     }
 }
示例#2
0
        public void Test_Update_UpdatesRestaurantInDatabase()
        {
            //Arrange
            string     style      = "Cafe, baby";
            string     name       = "Baby Cafe";
            Restaurant testaurant = new Restaurant(name, style, 1);

            testaurant.Save();
            string newStyle = "Fine Dining";
            string newName  = "Dine Fining";

            //Act
            testaurant.Update("Fine Dining", "Dine Fining");
            string result = testaurant.GetStyle();

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