Пример #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       addressEquality     = this.getAddress() == newRestaurant.getAddress();
                bool       phoneNumberEquality = this.getPhoneNumber() == newRestaurant.getPhoneNumber();
                bool       cuisineIdEquality   = this.getCusineId() == newRestaurant.getCusineId();

                return(idEquality && nameEquality && addressEquality && phoneNumberEquality && cuisineIdEquality);
            }
        }
Пример #2
0
        public void Test_Update_UpdatesCuisineInDatabase()
        {
            string  name1        = "Thai";
            Cuisine testCuisine1 = new Cuisine(name1);

            testCuisine1.Save();
            //Arrange
            string     name           = "RedLobster";
            Restaurant testRestaurant = new Restaurant(name, "happyStreet", "333444343", testCuisine1.GetId());

            testRestaurant.Save();
            string newName = "GreenLobster";

            //Act
            testRestaurant.UpdateName(newName);

            string result = testRestaurant.getName();

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