Exemplo n.º 1
0
        private void AllocateUsers(List <UserType> userTypes)
        {
            var expiresIn = _scenario.ScenarioInfo.Tags.Any(x => x.Contains("HearingTest"))
                ? ALLOCATE_USERS_FOR_HEARING_TESTS
                : ALLOCATE_USERS_FOR_MINUTES;

            var request = new AllocateUsersRequest()
            {
                Application       = Application.VideoWeb,
                Expiry_in_minutes = expiresIn,
                Is_prod_user      = _c.VideoWebConfig.IsLive,
                Test_type         = TestType.Automated,
                User_types        = userTypes
            };

            if (_c.VideoWebConfig.SauceLabsConfiguration.RunningOnSauceLabs())
            {
                Thread.Sleep(TimeSpan.FromSeconds(GetRandomNumberForParallelExecution(15)));
            }

            var response = _c.Apis.TestApi.AllocateUsers(request);

            response.StatusCode.Should().Be(HttpStatusCode.OK);
            response.Should().NotBeNull();
            var users = RequestHelper.Deserialise <List <UserDetailsResponse> >(response.Content);

            users.Should().NotBeNullOrEmpty();
            _c.Test.Users = UserDetailsResponseToUsersMapper.Map(users);
            _c.Test.Users.Should().NotBeNullOrEmpty();
        }
Exemplo n.º 2
0
        private void AllocateUsers(List <UserType> userTypes)
        {
            var expiresIn = _scenario.ScenarioInfo.Tags.Any(x => x.Contains("HearingTest"))
                ? ALLOCATE_USERS_FOR_HEARING_TESTS
                : ALLOCATE_USERS_FOR_MINUTES;

            var request = new AllocateUsersRequest()
            {
                Application     = Application.VideoWeb,
                ExpiryInMinutes = expiresIn,
                IsEjud          = _c.VideoWebConfig.UsingEjud,
                IsProdUser      = _c.VideoWebConfig.IsLive,
                TestType        = TestType.Automated,
                UserTypes       = userTypes
            };

            var response = _c.Apis.TestApi.AllocateUsers(request);

            response.StatusCode.Should().Be(HttpStatusCode.OK);
            response.Should().NotBeNull();
            var users = RequestHelper.Deserialise <List <UserDetailsResponse> >(response.Content);

            users.Should().NotBeNullOrEmpty();
            _c.Test.Users = UserDetailsResponseToUsersMapper.Map(users);
            _c.Test.Users.Should().NotBeNullOrEmpty();
        }
        private void Allocate()
        {
            var userTypes = new List <UserType>
            {
                UserType.Judge,
                UserType.VideoHearingsOfficer
            };

            if (_scenario.ScenarioInfo.Tags.Contains(UserType.Individual.ToString()))
            {
                userTypes.Add(UserType.Individual);
            }
            else if (_scenario.ScenarioInfo.Tags.Contains(UserType.Representative.ToString()))
            {
                userTypes.Add(UserType.Representative);
            }
            else if (_scenario.ScenarioInfo.Tags.Contains(UserType.PanelMember.ToString()))
            {
                userTypes.Add(UserType.PanelMember);
                userTypes.Add(UserType.Individual);
            }
            else if (_scenario.ScenarioInfo.Tags.Contains(UserType.Winger.ToString()))
            {
                userTypes.Add(UserType.Winger);
                userTypes.Add(UserType.Individual);
            }
            else
            {
                userTypes.Add(UserType.Individual);
            }

            var request = new AllocateUsersRequest()
            {
                Application     = Application.ServiceWeb,
                ExpiryInMinutes = ALLOCATE_USERS_FOR_MINUTES,
                IsProdUser      = _c.WebConfig.IsLive,
                TestType        = TestType.Automated,
                UserTypes       = userTypes
            };

            var response = _c.Api.AllocateUsers(request);

            response.StatusCode.Should().Be(HttpStatusCode.OK);
            response.Should().NotBeNull();
            var users = RequestHelper.Deserialise <List <UserDetailsResponse> >(response.Content);

            users.Should().NotBeNullOrEmpty();
            _c.Users = UserDetailsResponseToUsersMapper.Map(users);
            _c.Users.Should().NotBeNullOrEmpty();
        }
        private void AllocateSingleUser(UserType userType)
        {
            var request = new AllocateUserRequest()
            {
                Application     = Application.VideoWeb,
                ExpiryInMinutes = 1,
                IsProdUser      = _c.VideoWebConfig.IsLive,
                TestType        = TestType.Automated,
                UserType        = userType
            };

            var response = _c.Apis.TestApi.AllocateUser(request);

            response.StatusCode.Should().Be(HttpStatusCode.OK);
            response.Should().NotBeNull();
            var user = RequestHelper.Deserialise <UserDetailsResponse>(response.Content);

            user.Should().NotBeNull();
            _c.Test.Users = UserDetailsResponseToUsersMapper.Map(user);
        }