Ejemplo n.º 1
0
 public override bool Equals(System.Object otherContactInfo)
 {
     if (!(otherContactInfo is ContactInfo))
     {
         return(false);
     }
     else
     {
         ContactInfo newContactInfo     = (ContactInfo)otherContactInfo;
         bool        idEquality         = (this.GetId() == newContactInfo.GetId());
         bool        addressEquality    = (this.GetAddress() == newContactInfo.GetAddress());
         bool        phoneEquality      = (this.GetPhone() == newContactInfo.GetPhone());
         bool        restaurantEquality = this.GetRestaurantId() == newContactInfo.GetRestaurantId();
         return(idEquality && addressEquality && phoneEquality && restaurantEquality);
     }
 }
        public void Test_Update_ReturnsTrueIfRestaurantIdsAreTheSame()
        {
            //Arrange
            Restaurant newRestaurant = new Restaurant("Saburos", "a sushi place", 1);

            newRestaurant.Save();
            ContactInfo firstContactInfo = new ContactInfo("906 President st. Brooklyn, NY", 2128675309, newRestaurant.GetId());

            firstContactInfo.Save();
            ContactInfo secondContactInfo = new ContactInfo("906 President st. Brooklyn, NY", 1234567890, 3, firstContactInfo.GetId());

            //Act
            secondContactInfo.Update(2128675309, firstContactInfo.GetRestaurantId());

            //Assert
            Assert.Equal(firstContactInfo, secondContactInfo);
        }