public void Test_Find_FindsRestaurantDatabase()
        {
            Restaurant testRestaurant = new Restaurant("GreatWall", "Buffet", 1);

            testRestaurant.Save();

            Restaurant foundRestaurant = Restaurant.Find(testRestaurant.GetId());

            Assert.Equal(testRestaurant, foundRestaurant);
        }
        public void Test_Find_FindsRestaurantInDatabase()
        {
            Restaurant testRestaurant = new Restaurant("Tako", "Not a place to get tacos.", "$", 1);

            testRestaurant.Save();

            Restaurant foundRestaurant = Restaurant.Find(testRestaurant.GetId());

            Assert.Equal(testRestaurant, foundRestaurant);
        }
        public void Test_SaveAssignsIdtoObject()
        {
            Restaurant testRestaurant = new Restaurant("GreatWall", "Buffet", 1);

            testRestaurant.Save();

            Restaurant savedRestaurant = Restaurant.GetAll()[0];

            int result = savedRestaurant.GetId();
            int testId = testRestaurant.GetId();

            Assert.Equal(testId, result);
        }
Esempio n. 4
0
        public void Test_Find_FindsRestaurantInDatabase()
        {
            //Arrange
            Restaurant testRestaurant = new Restaurant("Departure", "desc2", 2);

            testRestaurant.Save();

            //Act
            Restaurant foundRestaurant = Restaurant.Find(testRestaurant.GetId());

            //Assert
            Assert.Equal(testRestaurant, foundRestaurant);
        }
        public void Test_Save_AssignsIdToRestaurantObject()
        {
            Restaurant testRestaurant = new Restaurant("Tako", "Not a place to get tacos.", "$", 1);

            testRestaurant.Save();

            Restaurant savedRestaurant = Restaurant.GetAll()[0];

            int testId = testRestaurant.GetId();
            int result = savedRestaurant.GetId();

            Assert.Equal(testId, result);
        }
Esempio n. 6
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();
         return(idEquality && nameEquality);
     }
 }
Esempio n. 7
0
        public void Test_Save_AssignsIdToRestaurantObject()
        {
            //Arrange
            Restaurant testRestaurant = new Restaurant("Departure", "desc2", 2);

            testRestaurant.Save();

            //Act
            Restaurant savedRestaurant = Restaurant.GetAll()[0];

            int result = savedRestaurant.GetId();
            int testId = testRestaurant.GetId();

            //Assert
            Assert.Equal(testId, result);
        }
        public void Test_Update_UpdatesRestaurantInDatabase()
        {
            string     name           = "Tako";
            string     description    = "Not a place to get tacos.";
            string     price          = "$$";
            int        cuisineId      = 1;
            Restaurant testRestaurant = new Restaurant(name, description, price, cuisineId);

            testRestaurant.Save();

            string newName        = "Mario\'s";
            string newDescription = "Fresh pasta, fresh sauce.";
            string newPrice       = "$";
            int    newCuisineId   = 2;

            testRestaurant.Update(newName, newDescription, newPrice, newCuisineId);

            Restaurant result               = Restaurant.GetAll()[0];
            int        compareId            = result.GetId();
            Restaurant comparisonRestaurant = new Restaurant(newName, newDescription, newPrice, newCuisineId, compareId);

            Assert.Equal(comparisonRestaurant, result);
        }