public IRunspaceData Get(string userId, string runspaceId)
        {
            _logger.LogInformation($"Get runspace with id: {runspaceId}");
            IRunspaceData result = null;

            try {
                Sessions.Instance.EnsureValidUser(userId);

                if (!_userRunspaces.Contains(userId))
                {
                    throw new RunspaceProviderException(
                              string.Format(APIGatewayResources.MultiTenantRunspaceProvider_UserHasNoRunspaces, userId));
                }

                if (!_userRunspaces.Contains(userId, runspaceId))
                {
                    throw new RunspaceProviderException(
                              string.Format(APIGatewayResources.MultiTenantRunspaceProvider_UserHasNoRunspaceWithId, userId, runspaceId));
                }

                var runspaceInfo = _runspaceProvider.Get(runspaceId);
                var runspaceData = _userRunspaces.GetData(userId, runspaceId);
                if (runspaceInfo == null && runspaceData != null)
                {
                    _userRunspaces.RemoveData(userId, runspaceId);
                }
                else
                {
                    result = runspaceData;
                }
            } catch (Exception ex) {
                throw new RunspaceProviderException(
                          string.Format(
                              APIGatewayResources.MultiTenantRunspaceProvider_GetFailed,
                              userId,
                              ex.Message),
                          ex);
            }

            return(result);
        }
        public void GetData()
        {
            // Arrange
            const string UserID        = "user-id";
            const string RunspaceID1   = "runspace-id1";
            const string RunspaceData1 = "runspace-data1";
            const string RunspaceID2   = "runspace-id2";
            const string RunspaceData2 = "runspace-data2";
            var          userRunspaces = new UserToIdentifiableData <string>();

            userRunspaces.Add(UserID, RunspaceID1, RunspaceData1);
            userRunspaces.Add(UserID, RunspaceID2, RunspaceData2);

            // Act
            var actualData = userRunspaces.GetData(UserID, RunspaceID2);

            // Assert
            Assert.NotNull(actualData);
            Assert.AreEqual(RunspaceData2, actualData);
        }