Beispiel #1
0
        public void Remove_RemoveAllUsersFromGroup_GroupIsDeleted_AssertFalse()
        {
            var roleManager = new HubGroupManager <string>();

            roleManager.AddToGroup("User", "User1", "thirdConnection");
            roleManager.AddToGroup("Admin", "User1", "firstConnection");
            roleManager.AddToGroup("Coach", "User2", "secondConnection");
            roleManager.AddToGroup("User", "User2", "secondConnection");

            roleManager.RemoveFromGroup("User1", "thirdConnection");
            roleManager.RemoveFromGroup("User2", "secondConnection");

            var result = roleManager.IsGroupExist("User");

            Assert.IsFalse(result);
        }
Beispiel #2
0
 private void RemoveInThread(HubGroupManager <string> roleManager, int from, int to)
 {
     for (int i = from; i < to; i++)
     {
         roleManager.RemoveFromGroup($"User{i}", "Connection");
     }
 }
Beispiel #3
0
        public void Remove_RemoveUserConnection_UserIsNotDeleteIfConnectionExsist()
        {
            var roleManager = new HubGroupManager <string>();

            roleManager.AddToGroup("User", "User1", "thirdConnection");
            roleManager.AddToGroup("User", "User1", "firstConnection");
            roleManager.AddToGroup("User", "User2", "secondConnection");

            roleManager.RemoveFromGroup("User1", "thirdConnection");

            var user = roleManager.GetUsersFromGroup("User")
                       .FirstOrDefault(x => x.UserId == "User1");

            bool result = user != null;

            Assert.IsTrue(result);
        }