public void RemoveClientTest(string client) { //Arrange PermissionMemoryCache permissionMemoryCache = new PermissionMemoryCache(); permissionMemoryCache.AddClient("client1", null); permissionMemoryCache.AddClient("client2", null); permissionMemoryCache.AddClient("client3", Permissions.ALL); permissionMemoryCache.AddClient("client4", Permissions.CREATE_PROJECTS | Permissions.DELETE_PROJECTS); //Act permissionMemoryCache.RemoveClient(client); //get all clients var clients = permissionMemoryCache.GetClients(null).ToList(); //Assert //we expect these clients Assert.DoesNotContain(client, clients); Assert.Equal(3, clients.Count); }
public override Task OnDisconnectedAsync(Exception exception) { _permissionMemoryCache.RemoveClient(Context.ConnectionId); return(base.OnDisconnectedAsync(exception)); }