public static WhenStatement CreateNewTimeSeriesRequestIsSend(this WhenStatement whenStatement, string testKey = null) { whenStatement.GetStatementLogger() .Information("[{ContextStatement}] Creating new time-series", whenStatement.GetType().Name); var session = whenStatement.GetSessionFromData(testKey); var newTimeSeries = whenStatement.GetGivenData <TestTimeSeriesMetadataModel>(BddKeyConstants.TimeSeriesToCreate + testKey); var response = _facade.PostCreateTimeSeries(session, newTimeSeries); whenStatement.AddResultData(response, BddKeyConstants.LastHttpResponse + testKey); try { var createdTimeSeries = response.Map <TestTimeSeriesMetadataModel>(); whenStatement.GetStatementLogger() .Information($"[{{ContextStatement}}] Got time-series {createdTimeSeries}", whenStatement.GetType().Name); newTimeSeries.Id = createdTimeSeries.Id; newTimeSeries.InfluxId = createdTimeSeries.InfluxId; newTimeSeries.UserId = createdTimeSeries.UserId; whenStatement.AddResultData(createdTimeSeries, BddKeyConstants.CreatedTimeSeries + testKey); } catch { whenStatement.GetStatementLogger() .Information("[{ContextStatement}] Could not find new time-series in response", whenStatement.GetType().Name); } return(whenStatement); }
public static WhenStatement GetAllTimeSeriesRequestIsSend(this WhenStatement whenStatement, string testKey = null) { whenStatement.GetStatementLogger() .Information("[{ContextStatement}] Getting all user time-series", whenStatement.GetType().Name); var session = whenStatement.GetSessionFromData(testKey); var response = _facade.GetAllTimeSeries(session); whenStatement.AddResultData(response, BddKeyConstants.LastHttpResponse + testKey); try { var createdTimeSeries = response.Map <List <TestTimeSeriesMetadataModel> >(); whenStatement.GetStatementLogger() .Information($"[{{ContextStatement}}] Got time-series {createdTimeSeries}", whenStatement.GetType().Name); whenStatement.AddResultData(createdTimeSeries, BddKeyConstants.UserTimeSeries + testKey); } catch { whenStatement.GetStatementLogger() .Information("[{ContextStatement}] Could not find list of time-series in response", whenStatement.GetType().Name); } return(whenStatement); }
public static WhenStatement GetTimeSeriesMetadataByIdRequestIsSend(this WhenStatement whenStatement, string timeSeriesId, string testKey = null) { whenStatement.GetStatementLogger() .Information("[{ContextStatement}] Getting user time-series by id", whenStatement.GetType().Name); var session = whenStatement.GetSessionFromData(testKey); var response = _facade.GetTimeSeriesMetadataById(session, timeSeriesId); whenStatement.AddResultData(response, BddKeyConstants.LastHttpResponse + testKey); try { var timeSeries = response.Map <TestTimeSeriesMetadataModel>(); whenStatement.GetStatementLogger() .Information($"[{{ContextStatement}}] Got time-series {timeSeries}", whenStatement.GetType().Name); whenStatement.AddResultData(timeSeries, BddKeyConstants.UserTimeSeriesById + testKey); } catch { whenStatement.GetStatementLogger() .Information("[{ContextStatement}] Could not find time-series in response", whenStatement.GetType().Name); } return(whenStatement); }
public static WhenStatement GetCurrentUserRequestIsSend(this WhenStatement whenStatement, string testKey = null) { whenStatement.GetStatementLogger() .Information("[{ContextStatement}] Getting current user", whenStatement.GetType().Name); var session = whenStatement.GetSessionFromData(testKey); var response = _facade.GetMe(session); whenStatement.AddResultData(response, BddKeyConstants.LastHttpResponse + testKey); try { var currentUser = response.Map <TestUserModel>(); whenStatement.GetStatementLogger() .Information($"[{{ContextStatement}}] Got user {currentUser}", whenStatement.GetType().Name); whenStatement.AddResultData(currentUser, BddKeyConstants.CurrentUserResponse + testKey); } catch { whenStatement.GetStatementLogger() .Information("[{ContextStatement}] Could not find current user in response", whenStatement.GetType().Name); } return(whenStatement); }
public static WhenStatement LoginRequestIsSend(this WhenStatement whenStatement, string testKey = null) { var loginCredentials = whenStatement.GetGivenData <TestLoginModel>(testKey); whenStatement.GetStatementLogger() .Information($"[{{ContextStatement}}] Logging in with {loginCredentials}", whenStatement.GetType().Name); var response = _facade.PostLogin(loginCredentials); whenStatement.AddResultData(response, BddKeyConstants.LastHttpResponse + testKey); try { var session = response.GetTokenFromResponse(); whenStatement.GetStatementLogger() .Information($"[{{ContextStatement}}] Got session {session}", whenStatement.GetType().Name); whenStatement.AddResultData(session, BddKeyConstants.SessionTokenKey + testKey); } catch (Exception e) { whenStatement.GetStatementLogger() .Warning($"[{{ContextStatement}}] {e}", whenStatement.GetType().Name); } return(whenStatement); }
public static WhenStatement CreateUserRequestIsSend(this WhenStatement whenStatement, string testKey = null) { var userModel = whenStatement.GetGivenData <TestUserModel>(testKey); whenStatement.GetStatementLogger() .Information($"[{{ContextStatement}}] Creating user {userModel}", whenStatement.GetType().Name); var response = _facade.PostCreateNewProfile(userModel); whenStatement.AddResultData(response, BddKeyConstants.LastHttpResponse + testKey); try { var createdUser = response.Map <TestUserModel>(); whenStatement.GetStatementLogger() .Information($"[{{ContextStatement}}] Got new user {createdUser}", whenStatement.GetType().Name); whenStatement.AddResultData(createdUser, BddKeyConstants.CreatedUserResponse + testKey); } catch (Exception e) { whenStatement.GetStatementLogger() .Warning($"[{{ContextStatement}}] {e}", whenStatement.GetType().Name); } return(whenStatement); }
public static WhenStatement LogoutRequestIsSend(this WhenStatement whenStatement, string testKey = null) { var session = whenStatement.GetSessionFromData(testKey); whenStatement.GetStatementLogger() .Information($"[{{ContextStatement}}] Closing session '{session}'", whenStatement.GetType().Name); var response = _facade.PostLogout(session); whenStatement.AddResultData(response, BddKeyConstants.LastHttpResponse + testKey); return(whenStatement); }
public static WhenStatement GetApiKeysRequestIsSend(this WhenStatement whenStatement, string testKey = null) { var response = _facade.GetApiKeys(whenStatement.GetSessionFromData(testKey)); whenStatement.AddResultData(response, BddKeyConstants.LastHttpResponse); try { var apiKeys = response.Map <TestApiKeysList>(); whenStatement.GetStatementLogger() .Information($"[{{ContextStatement}}] Got api keys {apiKeys}", whenStatement.GetType().Name); whenStatement.AddResultData(apiKeys, BddKeyConstants.UserApiKeys + testKey); } catch { whenStatement.GetStatementLogger() .Information("[{ContextStatement}] Could not find api keys in response", whenStatement.GetType().Name); } return(whenStatement); }
public static WhenStatement RemoveTimeSeriesRequestIsSend(this WhenStatement whenStatement, string timeSeriesId, string testKey = null) { whenStatement.GetStatementLogger() .Information("[{ContextStatement}] Removing time-series", whenStatement.GetType().Name); var session = whenStatement.GetSessionFromData(testKey); var response = _facade.DeleteTimeSeriesById(session, timeSeriesId); whenStatement.AddResultData(response, BddKeyConstants.LastHttpResponse + testKey); return(whenStatement); }
public static WhenStatement DeleteApiKeyRequestIsSend(this WhenStatement whenStatement, string testKey = null) { var apiKey = whenStatement.GetGivenData <string>(BddKeyConstants.ApiKeyToRemove + testKey); whenStatement.GetStatementLogger() .Information($"[{{ContextStatement}}] Removing api key '{apiKey}'", whenStatement.GetType().Name); var response = _facade.DeleteApiKey(whenStatement.GetSessionFromData(testKey), apiKey); whenStatement.AddResultData(response, BddKeyConstants.LastHttpResponse); return(whenStatement); }
public static WhenStatement UpdateUserRequestIsSend(this WhenStatement whenStatement, TestUserUpdateModel updateModel, string testKey = null) { whenStatement.GetStatementLogger() .Information("[{ContextStatement}] Getting current user", whenStatement.GetType().Name); var session = whenStatement.GetSessionFromData(testKey); var response = _facade.PostUpdateProfileNames(session, updateModel); whenStatement.AddResultData(response, BddKeyConstants.LastHttpResponse + testKey); return(whenStatement); }
public static WhenStatement UploadTimeSeriesDataRequestIsSend(this WhenStatement whenStatement, string fileContent, string testKey = null) { whenStatement.GetStatementLogger() .Information("[{ContextStatement}] Uploading .csv data to time-series", whenStatement.GetType().Name); var session = whenStatement.GetSessionFromData(testKey); var newTimeSeries = whenStatement.GetTimeSeriesFromDatas(testKey); var response = _facade.PostUploadTimeSeries(session, newTimeSeries.Id, fileContent); whenStatement.AddResultData(response, BddKeyConstants.LastHttpResponse + testKey); return(whenStatement); }
public static WhenStatement CreateNewApiKeyRequestIsSend(this WhenStatement whenStatement, string testKey = null) { var apiKey = whenStatement.GetGivenData <TestUserApiKeyJsonEntity>(BddKeyConstants.NewApiKey + testKey); whenStatement.GetStatementLogger() .Information($"[{{ContextStatement}}] Creating new api key '{apiKey}'", whenStatement.GetType().Name); var response = _facade.PostApiKeys(whenStatement.GetSessionFromData(testKey), apiKey); whenStatement.AddResultData(response, BddKeyConstants.LastHttpResponse); return(whenStatement); }
public static WhenStatement UpdateTimeSeriesRequestIsSend(this WhenStatement whenStatement, string testKey = null) { whenStatement.GetStatementLogger() .Information("[{ContextStatement}] Updating time-series", whenStatement.GetType().Name); var session = whenStatement.GetSessionFromData(testKey); var timeSeries = whenStatement.GetGivenData <TestTimeSeriesMetadataModel>(BddKeyConstants.TimeSeriesToUpdate + testKey); var response = _facade.PostUpdateTimeSeries(session, timeSeries.Id, timeSeries); whenStatement.AddResultData(response, BddKeyConstants.LastHttpResponse + testKey); return(whenStatement); }