Exemplo n.º 1
0
        public async Task <IActionResult> ManageHubUser(string roomNo)
        {
            var userMaster  = new Entities.Models.User();
            var groupMaster = _manageHubUser.GetGroupMaster(roomNo);

            if (groupMaster != null)
            {
                userMaster = _repo.User.FindByCondition(u => u.Id == groupMaster.First().UserId).FirstOrDefault();
            }

            var connectedUsers = new List <HubUserVM>();

            GenerateHubUserVM(connectedUsers, _manageHubUser.GetConnectedUsers(roomNo));

            var waitingUsers = new List <HubUserVM>();

            GenerateHubUserVM(waitingUsers, _manageHubUser.GetWaitingUsers(roomNo));

            ManageHubUserVM = new ManageHubUserViewModel()
            {
                GroupName      = roomNo,
                ConnectedUsers = connectedUsers,
                WaitingUsers   = waitingUsers,
                GroupMaster    = _mapper.Map <WebApp.Models.User>(userMaster)
            };

            return(View(ManageHubUserVM));
        }
Exemplo n.º 2
0
        public void TestGettingAllWaitingUsers()
        {
            var hubUsers = PrepareHubUsers();

            foreach (var user in hubUsers)
            {
                _manageHubUser.AddUser(user);
            }

            var waitingUsers = _manageHubUser.GetWaitingUsers();

            Assert.Equal(3, waitingUsers.Count());
        }