Пример #1
0
        public void TestRoomDao_AddRoom()
        {
            Room Room = new Room();
            Room.Id = "UnitTests";
            Room.Name = "單元測試";
            Room.maxpeople = "請做出單元測試";
            Room.weekdaysprice = "請做出單元測試";
            Room.holidayprice = "請做出單元測試";
            Room.statue = "請做出單元測試";
            RoomDao.AddRoom(Room);

            Room dbRoom = RoomDao.GetRoomByName(Room.Name);
            Assert.IsNotNull(dbRoom);
            Assert.AreEqual(Room.Name, dbRoom.Name);

            Console.WriteLine("課程編號為 = " + dbRoom.Id);
            Console.WriteLine("課程名稱為 = " + dbRoom.Name);
            Console.WriteLine("課程描述為 = " + dbRoom.maxpeople);
            Console.WriteLine("課程描述為 = " + dbRoom.weekdaysprice);
            Console.WriteLine("課程描述為 = " + dbRoom.holidayprice);
            Console.WriteLine("課程描述為 = " + dbRoom.statue);

            RoomDao.DeleteRoom(dbRoom);
            dbRoom = RoomDao.GetRoomByName(Room.Name);
            Assert.IsNull(dbRoom);
        }
Пример #2
0
        public void DeleteRoom(Room Room)
        {
            Room = RoomDao.GetRoomByName(Room.Name);

            if (Room != null)
            {
                RoomDao.DeleteRoom(Room);
            }
        }
Пример #3
0
 public void UpdateRoom(Room Room)
 {
     RoomDao.UpdateRoom(Room);
 }
Пример #4
0
 public Room AddRoom(Room Room)
 {
     RoomDao.AddRoom(Room);
     return GetRoomByName(Room.Name);
 }