Exemplo n.º 1
0
        public void TestSmokeGetAfterUpdateTimeSeriesMetadata()
        {
            var timeSeries = new TestTimeSeriesMetadataModel
            {
                Description = TestStringHelper.RandomLatinString(),
                Name        = TestStringHelper.RandomLatinString(),
            };

            var updatedTimeSeries = new TestTimeSeriesMetadataModel
            {
                Description = TestStringHelper.RandomLatinString(),
                Name        = TestStringHelper.RandomLatinString(),
            };

            Given
            .NewTimeSeries(timeSeries)
            .UpdateTimeSeries(updatedTimeSeries)
            .UserSession(Session)
            .When
            .CreateNewTimeSeriesRequestIsSend()
            .UpdateGivenUpdateTimeSeriesIdsFromModel(timeSeries)
            .UpdateTimeSeriesRequestIsSend()
            .GetTimeSeriesMetadataByIdRequestIsSend(timeSeries.Id)
            .Then
            .TimeSeriesByIdIsEqualTo(updatedTimeSeries);
        }
Exemplo n.º 2
0
        public void TestUpdateRemovedTimeSeriesMetadataById()
        {
            var timeSeries = new TestTimeSeriesMetadataModel
            {
                Description = TestStringHelper.RandomLatinString(),
                Name        = TestStringHelper.RandomLatinString(),
            };

            var updatedTimeSeries = new TestTimeSeriesMetadataModel
            {
                Description = TestStringHelper.RandomLatinString(),
                Name        = TestStringHelper.RandomLatinString(),
            };

            Given
            .NewTimeSeries(timeSeries)
            .UpdateTimeSeries(updatedTimeSeries)
            .UserSession(Session)
            .When
            .CreateNewTimeSeriesRequestIsSend()
            .UpdateGivenUpdateTimeSeriesIdsFromModel(timeSeries)
            .UpdateTimeSeriesRequestIsSend()
            .RemoveTimeSeriesRequestIsSend(timeSeries.Id)
            .WithSuccess()
            .UpdateTimeSeriesRequestIsSend()
            .Then
            .ResponseHasCode(HttpStatusCode.NotFound);
        }
Exemplo n.º 3
0
        public void TestSmokeGetAllAfterUpdateTimeSeries()
        {
            var timeSeries = new TestTimeSeriesMetadataModel
            {
                Description = TestStringHelper.RandomLatinString(),
                Name        = TestStringHelper.RandomLatinString(),
            };

            var updatedTimeSeries = new TestTimeSeriesMetadataModel
            {
                Description = TestStringHelper.RandomLatinString(),
                Name        = TestStringHelper.RandomLatinString(),
            };

            Given
            .NewTimeSeries(timeSeries)
            .UpdateTimeSeries(updatedTimeSeries)
            .UserSession(Session)
            .When
            .CreateNewTimeSeriesRequestIsSend()
            .UpdateTimeSeriesRequestIsSend()
            .GetAllTimeSeriesRequestIsSend()
            .Then
            .TimeSeriesIsPresentInUserTimeSeries(updatedTimeSeries);
        }
Exemplo n.º 4
0
        public void TestSmokeCreateNewProfile()
        {
            var profile = new TestUserModel
            {
                Email     = $"{TestStringHelper.RandomLatinString()}@example.com",
                Password  = TestStringHelper.RandomLatinString(),
                FirstName = TestStringHelper.RandomLatinString(),
                LastName  = TestStringHelper.RandomLatinString(),
            };

            Given
            .NewUserData(profile)
            .When
            .CreateUserRequestIsSend()
            .Then
            .LastRequestSuccessful();

            Given
            .UserLoginCredentials(new TestLoginModel
            {
                Email    = profile.Email,
                Password = profile.Password
            })
            .When
            .LoginRequestIsSend()
            .GetCurrentUserRequestIsSend()
            .Then
            .CurrentUserIsEqualTo(profile)
            .LogoutIfSessionTokenIsPresent();
        }
Exemplo n.º 5
0
        public void TestSmokeApiKeys()
        {
            var newKeyDescription = TestStringHelper.RandomLatinString();

            var userKeys =
                Given
                .UserSession(Session)
                .NewApiKey(new TestUserApiKeyJsonEntity
            {
                Description = newKeyDescription
            })
                .When
                .CreateNewApiKeyRequestIsSend()
                .GetApiKeysRequestIsSend()
                .Then
                .UsersApiKeysContainGiven()
                .GetResultData <TestApiKeysList>(BddKeyConstants.UserApiKeys);

            var apiKeyId = userKeys.Entities.First(e => e.Description.Equals(newKeyDescription)).Id;

            Given
            .UserSession(Session)
            .ApiKeyToRemove(apiKeyId)
            .When
            .DeleteApiKeyRequestIsSend()
            .GetApiKeysRequestIsSend()
            .Then
            .UsersApiKeysDoNotContainGiven();
        }
Exemplo n.º 6
0
        public void TestSmokeForNewUserMe()
        {
            var userModel = new TestUserModel()
            {
                Email     = $"{TestStringHelper.RandomLatinString()}@example.com",
                Password  = TestStringHelper.RandomLatinString(),
                FirstName = TestStringHelper.RandomLatinString(),
                LastName  = TestStringHelper.RandomLatinString(),
            };

            Given
            .NewUserData(userModel)
            .UserLoginCredentials(new TestLoginModel
            {
                Email    = userModel.Email,
                Password = userModel.Password,
            })
            .When
            .CreateUserRequestIsSend()
            .LoginRequestIsSend()
            .GetCurrentUserRequestIsSend()
            .Then
            .CurrentUserIsEqualTo(userModel)
            .LogoutIfSessionTokenIsPresent();
        }
Exemplo n.º 7
0
 public void TestUpdateWithSessionEmpty(string session)
 {
     Given
     .UserSession(session)
     .When
     .UpdateUserRequestIsSend(new TestUserUpdateModel
     {
         FirstName = TestStringHelper.RandomLatinString(),
         LastName  = TestStringHelper.RandomLatinString()
     })
     .Then
     .ResponseHasCode(HttpStatusCode.Unauthorized);
 }
Exemplo n.º 8
0
 public void LoginWithBadLogin()
 {
     Given
     .UserLoginCredentials(new TestLoginModel
     {
         Email    = TestStringHelper.RandomLatinString(),
         Password = Configuration.UserName
     })
     .When
     .LoginRequestIsSend()
     .Then
     .ResponseHasCode(HttpStatusCode.Unauthorized);
 }
Exemplo n.º 9
0
        public void TestCreateNewTimeSeriesSessionToken(string sessionToken)
        {
            var timeSeries = new TestTimeSeriesMetadataModel
            {
                Name = TestStringHelper.RandomLatinString(),
            };

            Given
            .NewTimeSeries(timeSeries)
            .UserSession(sessionToken)
            .When
            .CreateNewTimeSeriesRequestIsSend()
            .Then
            .ResponseHasCode(HttpStatusCode.Unauthorized);
        }
Exemplo n.º 10
0
        public void TestUpdateTimeSeriesMetadataByIdSessionToken(string sessionToken)
        {
            var updatedTimeSeries = new TestTimeSeriesMetadataModel
            {
                Description = TestStringHelper.RandomLatinString(),
                Name        = TestStringHelper.RandomLatinString(),
            };

            Given
            .UpdateTimeSeries(updatedTimeSeries)
            .UserSession(sessionToken)
            .When
            .UpdateTimeSeriesRequestIsSend()
            .Then
            .ResponseHasCode(HttpStatusCode.Unauthorized);
        }
Exemplo n.º 11
0
        public void TestSmokeCreateNewTimeSeries()
        {
            var timeSeries = new TestTimeSeriesMetadataModel
            {
                Description = TestStringHelper.RandomLatinString(),
                Name        = TestStringHelper.RandomLatinString(),
            };

            Given
            .NewTimeSeries(timeSeries)
            .UserSession(Session)
            .When
            .CreateNewTimeSeriesRequestIsSend()
            .Then
            .CreatedTimeSeriesIsEqualToExpected();
        }
Exemplo n.º 12
0
        public void TestCreateNewTimeSeriesDateModified(string date)
        {
            var timeSeries = new TestTimeSeriesMetadataModel
            {
                Name         = TestStringHelper.RandomLatinString(),
                DateModified = date,
            };

            Given
            .NewTimeSeries(timeSeries)
            .UserSession(Session)
            .When
            .CreateNewTimeSeriesRequestIsSend()
            .Then
            .CreatedTimeSeriesIsEqualToExpected();
        }
        public void TestSmokeUploadTimeSeriesData()
        {
            var timeSeries = new TestTimeSeriesMetadataModel
            {
                Description = TestStringHelper.RandomLatinString(),
                Name        = TestStringHelper.RandomLatinString(),
            };

            Given
            .NewTimeSeries(timeSeries)
            .UserSession(Session)
            .When
            .CreateNewTimeSeriesRequestIsSend()
            .UploadTimeSeriesDataRequestIsSend("2021-01-10 11:14,1\n2021-01-10 11:16,3")
            .Then
            .LastRequestSuccessful();
        }
Exemplo n.º 14
0
        public void TestSmokeRemoveTimeSeriesMetadataById()
        {
            var timeSeries = new TestTimeSeriesMetadataModel
            {
                Description = TestStringHelper.RandomLatinString(),
                Name        = TestStringHelper.RandomLatinString(),
            };

            Given
            .NewTimeSeries(timeSeries)
            .UserSession(Session)
            .When
            .CreateNewTimeSeriesRequestIsSend()
            .RemoveTimeSeriesRequestIsSend(timeSeries.Id)
            .GetAllTimeSeriesRequestIsSend()
            .Then
            .TimeSeriesIsNotPresentInUserTimeSeries(timeSeries);
        }
Exemplo n.º 15
0
        public void TestDoubleUpdate()
        {
            var oldProfile = Given
                             .UserSession(Session)
                             .When
                             .GetCurrentUserRequestIsSend()
                             .GetResultData <TestUserModel>(BddKeyConstants.CurrentUserResponse);

            var updateModel = new TestUserUpdateModel
            {
                FirstName = TestStringHelper.RandomLatinString(),
                LastName  = TestStringHelper.RandomLatinString()
            };

            oldProfile.ApplyUpdate(updateModel);

            Given
            .UserSession(Session)
            .When
            .UpdateUserRequestIsSend(updateModel)
            .GetCurrentUserRequestIsSend()
            .Then
            .CurrentUserIsEqualTo(oldProfile);

            updateModel = new TestUserUpdateModel
            {
                FirstName = TestStringHelper.RandomLatinString(),
                LastName  = TestStringHelper.RandomLatinString()
            };
            oldProfile.ApplyUpdate(updateModel);

            Given
            .UserSession(Session)
            .When
            .UpdateUserRequestIsSend(updateModel)
            .GetCurrentUserRequestIsSend()
            .Then
            .CurrentUserIsEqualTo(oldProfile);
        }
Exemplo n.º 16
0
        public void TestDoubleUpdateTimeSeriesMetadataById()
        {
            var timeSeries = new TestTimeSeriesMetadataModel
            {
                Description = TestStringHelper.RandomLatinString(),
                Name        = TestStringHelper.RandomLatinString(),
            };

            var updatedTimeSeries = new TestTimeSeriesMetadataModel
            {
                Description = TestStringHelper.RandomLatinString(),
                Name        = TestStringHelper.RandomLatinString(),
            };

            Given
            .NewTimeSeries(timeSeries)
            .UpdateTimeSeries(updatedTimeSeries)
            .UserSession(Session)
            .When
            .UpdateTimeSeriesRequestIsSend()
            .UpdateGivenUpdateTimeSeriesIdsFromModel(timeSeries)
            .UpdateTimeSeriesRequestIsSend()
            .GetAllTimeSeriesRequestIsSend()
            .Then
            .TimeSeriesIsPresentInUserTimeSeries(updatedTimeSeries);

            updatedTimeSeries.Name        = TestStringHelper.RandomLatinString();
            updatedTimeSeries.Description = TestStringHelper.RandomLatinString();

            Given
            .UpdateTimeSeries(updatedTimeSeries)
            .UserSession(Session)
            .When
            .UpdateTimeSeriesRequestIsSend()
            .GetAllTimeSeriesRequestIsSend()
            .Then
            .TimeSeriesIsPresentInUserTimeSeries(updatedTimeSeries);
        }
Exemplo n.º 17
0
        public void TestUpdateTimeSeriesNameWithoutUpdate(string name)
        {
            var updatedTimeSeries = new TestTimeSeriesMetadataModel
            {
                Name = name,
            };
            var timeSeries = new TestTimeSeriesMetadataModel
            {
                Name = TestStringHelper.RandomLatinString(),
            };

            Given
            .NewTimeSeries(timeSeries)
            .UpdateTimeSeries(updatedTimeSeries)
            .UserSession(Session)
            .When
            .CreateNewTimeSeriesRequestIsSend()
            .UpdateGivenUpdateTimeSeriesIdsFromModel(timeSeries)
            .UpdateTimeSeriesRequestIsSend()
            .GetTimeSeriesMetadataByIdRequestIsSend(timeSeries.Id)
            .Then
            .TimeSeriesByIdIsEqualTo(timeSeries);
        }
Exemplo n.º 18
0
        public void TestUpdateOnlyLastName()
        {
            var oldProfile = Given
                             .UserSession(Session)
                             .When
                             .GetCurrentUserRequestIsSend()
                             .GetResultData <TestUserModel>(BddKeyConstants.CurrentUserResponse);

            var updateModel = new TestUserUpdateModel
            {
                FirstName = string.Empty,
                LastName  = TestStringHelper.RandomLatinString()
            };

            Given
            .UserSession(Session)
            .When
            .UpdateUserRequestIsSend(updateModel)
            .WithCode(HttpStatusCode.BadRequest)
            .GetCurrentUserRequestIsSend()
            .Then
            .CurrentUserIsEqualTo(oldProfile);
        }