public void Test_IdPassesCorrectly()
        {
            Restaurant testRestaurant = new Restaurant("Sushi", 1);
            int        result         = testRestaurant.GetId();

            Assert.Equal(0, result);
        }
        public void Test_Find()
        {
            Restaurant newRestaurant = new Restaurant("Italian", 2);

            newRestaurant.Save();
            Restaurant testRestaurant = Restaurant.Find(newRestaurant.GetId());

            Assert.Equal(testRestaurant, newRestaurant);
        }
Exemplo n.º 3
0
        public void Test_Find_FindsRestaurantInDatabase()
        {
            Restaurant testRestaurant = new Restaurant("Wolf & Bears", 1, "123 example st", "555-555-5555");

            testRestaurant.Save();

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

            Assert.Equal(testRestaurant, foundRestaurant);
        }
Exemplo n.º 4
0
    public void Test_Find_FindsRestaurantInDatabase()
    {
      //Arrange
      Restaurant testRestaurant = new Restaurant("Manny's",1);
      testRestaurant.Save();

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

      //Assert
      Assert.Equal(testRestaurant, foundRestaurant);
    }
Exemplo n.º 5
0
        public void Test_Find_FindsRestaurantInDatabase()
        {
            //Arrange
            Restaurant testRestaurant = new Restaurant("Chipotle", 1, new DateTime(1984, 9, 3), "In da hood");

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

            //Assert
            Assert.Equal(testRestaurant, foundRestaurant);
        }
Exemplo n.º 6
0
        public void Test_Save_AssignsIdToObject()
        {
            Restaurant testRestaurant = new Restaurant("Wolf & Bears", 1, "123 example st", "555-555-5555");

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

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

            Assert.Equal(testId, result);
        }
Exemplo n.º 7
0
        public void Test5_FindId()
        {
            //Arrange
            Restaurant testRestaurant = new Restaurant("thai");

            testRestaurant.Save();

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

            //Assert
            Assert.Equal(testRestaurant, foundRestaurant);
        }
Exemplo n.º 8
0
        public void Test_Update_UpdateRestaurantInDatabase()
        {
            //Arrange
            Restaurant testRestaurant = new Restaurant("Chipotle", 1, new DateTime(1984, 9, 3), "In da hood");

            testRestaurant.Save();
            //Act
            testRestaurant.Update("Starbucks", 1, new DateTime(3030, 9, 3), "Portland");
            Restaurant otherRestaurant = Restaurant.Find(testRestaurant.GetId());

            //Assert
            Assert.Equal(testRestaurant, otherRestaurant);
        }
Exemplo n.º 9
0
        public void Test_Find_FindsRestaurantInDatabase()
        {
            //Arrange
            Restaurant testRestaurant = new Restaurant("Le Fromage", 1, "24 Main St.", "10AM", "11PM");

            testRestaurant.Save();

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

            //Assert
            Assert.Equal(testRestaurant, foundRestaurant);
        }
Exemplo n.º 10
0
        public void Test_Save_AssignIdToObjects()
        {
            //Arrange
            Restaurant testRestaurant = new Restaurant("Cactus", 2, "24 Main St.", "10AM", "11PM");

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

            int expectedResult = testRestaurant.GetId();
            int actualResult   = savedRestaurant.GetId();

            Assert.Equal(expectedResult, actualResult);
        }
        public void Test_Update_RestaurantInDataBase()
        {
            string     originalRestaurantName    = "bob's mexican";
            int        originalRestaurantCuisine = 1;
            Restaurant originalRestaurant        = new Restaurant(originalRestaurantName, originalRestaurantCuisine);

            originalRestaurant.Save();
            string     newRestaurantName    = "Bob's sushi";
            int        newRestaurantCuisine = 2;
            Restaurant updatedRestaurant    = new Restaurant(newRestaurantName, newRestaurantCuisine);

            originalRestaurant.Update(newRestaurantName, newRestaurantCuisine);
            Console.WriteLine(originalRestaurant.GetId());
            Console.WriteLine(originalRestaurant.GetName());
            Console.WriteLine(originalRestaurant.GetCuisineId());

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

            Console.WriteLine(foundRestaurant.GetId());
            Console.WriteLine(foundRestaurant.GetName());
            Console.WriteLine(foundRestaurant.GetCuisineId());
            Assert.Equal(foundRestaurant, originalRestaurant);
        }
Exemplo n.º 12
0
 //override
 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       specialtyEquality = (this).GetSpecialty() == newRestaurant.GetSpecialty();
         return(idEquality && specialtyEquality);
     }
 }
Exemplo n.º 13
0
        public void Test_Find_FindsRestaurantInDatabase()
        {
            //arrange
            // int id = 1;
            Restaurant newRestaurant = new Restaurant("Lucia", 3, 1);

            newRestaurant.Save();

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

            //assert
            Assert.Equal(newRestaurant, foundRestaurant);
        }
Exemplo n.º 14
0
 public override bool Equals(System.Object otherRestaurant)
 {
     if (!(otherRestaurant is Restaurant))
     {
         return(false);
     }
     else
     {
         Restaurant newRestaurant               = (Restaurant)otherRestaurant;
         bool       restaurantIdEquality        = (this.GetId() == newRestaurant.GetId());
         bool       restaurantNameEquality      = (this.GetName() == newRestaurant.GetName());
         bool       restaurantCuisineIdEquality = (this.GetCuisineId() == newRestaurant.GetCuisineId());
         return(restaurantNameEquality && restaurantCuisineIdEquality && restaurantIdEquality);
     }
 }
Exemplo n.º 15
0
    public void Test_Save_AssignsIdToObject()
    {
      //Arrange
      Restaurant testRestaurant = new Restaurant("Mow the lawn",1);

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

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

      //Assert
      Assert.Equal(testId, result);
    }
Exemplo n.º 16
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);
     }
 }
Exemplo n.º 17
0
        public void Test4_SaveIdToDb()
        {
            //Arrange
            Restaurant testRestaurant = new Restaurant("thai");

            testRestaurant.Save();

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

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

            //Assert
            Assert.Equal(testRestaurantId, result);
        }
Exemplo n.º 18
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.GetRestaurantName() == newRestaurant.GetRestaurantName());
                bool       cuisineIdEquality = (this.GetCuisineId() == newRestaurant.GetCuisineId());
                bool       addressEquality   = (this.GetAddress() == newRestaurant.GetAddress());
                bool       openTimeEquality  = (this.GetOpenTime() == newRestaurant.GetOpenTime());
                bool       closeTimeEquality = (this.GetCloseTime() == newRestaurant.GetCloseTime());

                return(idEquality && nameEquality && cuisineIdEquality && addressEquality && openTimeEquality && closeTimeEquality);
            }
        }
Exemplo n.º 19
0
        public void Test_Update_UpdateRestaurantInDatabase()
        {
            string     RestaurantName = "Le Rmoges";
            Restaurant testRestaurant = new Restaurant(RestaurantName, 2, "24 MAIN St.", "10AM", "11PM");

            testRestaurant.Save();

            string newRestaurantName = "Le Fromage";
            int    newCuisineId      = 1;
            string newAddress        = "24 Main St.";
            string newOpenTime       = "11AM";
            string newCloseTime      = "11PM";

            testRestaurant.Update(newRestaurantName, newCuisineId, newAddress, newOpenTime, newCloseTime);
            Restaurant actualResult   = testRestaurant;
            Restaurant expectedResult = new Restaurant(newRestaurantName, newCuisineId, newAddress, newOpenTime, newCloseTime, testRestaurant.GetId());

            Assert.Equal(expectedResult, actualResult);
        }