public void GetRoomTest()
        {
            List <Rooms> rooms = new List <Rooms> ();

            rooms = roomDAL.GetRooms();
            string query      = $"select * from Rooms order by rand() limit 1 ;";
            Rooms  roomRand   = GetRoomExecQuery(query);
            string query1     = $"select * from Rooms order by room_id asc limit 1; ";
            Rooms  roomTop    = GetRoomExecQuery(query1);
            string query2     = $"select * from Rooms order by room_id desc limit 1;";
            Rooms  roomBottom = GetRoomExecQuery(query2);

            Assert.NotNull(rooms);
            Assert.NotNull(roomRand);
            Assert.NotNull(roomTop);
            Assert.NotNull(roomBottom);

            //  So sanh vi tri Top Bottom va Rand xem co giong trong List.
            Assert.True(roomTop.Room_id == rooms[0].Room_id);
            Assert.True(roomBottom.Room_id == rooms[rooms.Count - 1].Room_id);
            Assert.Contains(roomRand, rooms);
        }
Esempio n. 2
0
 public List <Rooms> GetRooms()
 {
     return(dal.GetRooms());
 }