Example #1
0
        public void DeleteTest()
        {
            //Arrange
            db = new touch_for_foodEntities();
            TableOM target = new TableOM(db);
            int expected = 3;
            int actual;

            table t = db.tables.Find(table1.id);

            //Check Setup
            Assert.IsNotNull(db.tables.Find(table1.id));
            Assert.IsNotNull(db.orders.Find(order1.id).table_id);
            Assert.IsNotNull(db.service_request.Find(serviceRequest1.id).table_id);

            //Act
            actual = target.delete(table1.id);

            //Assert
            db = new touch_for_foodEntities();
            Assert.IsNull(db.tables.Find(table1.id));
            Assert.IsNull(db.orders.Find(order1.id).table_id);
            Assert.IsNull(db.service_request.Find(serviceRequest1.id).table_id);
            Assert.AreEqual(expected, actual);
        }
Example #2
0
 public TableController()
 {
     im = new TableIM(db);
     om = new TableOM(db);
 }
Example #3
0
 private void clearTables(ICollection<table> tables)
 {
     TableOM om = new TableOM(db);
     for (int i = 0; i < tables.Count; i++)
     {
         om.delete(tables.ElementAt(i).id);
     }
 }