Exemplo n.º 1
0
        public void GivenIProvideParameterAsUsernameAndAsPassword(string username, string password, Table credentials)
        {
            foreach (var row in credentials.Rows)
            {
                var wc = new WebClientHelper(WebClientHelper.AUTHORIZATION, TokenServiceHelper.CreateAuthorizationHeaderValue(row[username], row[password]));

                webClients.Add(wc);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Setup the logins for a Scenario
        /// </summary>
        /// <returns>List of valid WebClientHelper with WebClients correctly configured</returns>
        public static List<WebClientHelper> SetupLogins(string userName, string password, string loginUrl, Table table)
        {
            var serviceUrl = GetTokenUrl(loginUrl);
            var webClients = new List<WebClientHelper>();

            foreach (var row in table.Rows)
            {
                var wc = new WebClientHelper(WebClientHelper.AUTHORIZATION, CreateAuthorizationHeaderValue(row[userName], row[password]));

                var authenticationToken = wc.GetJsonObject(serviceUrl);

                wc = new WebClientHelper(TOKEN, authenticationToken.Value<string>(ENCRYPTED_TOKEN));

                webClients.Add(wc);
            }

            return webClients;
        }        
Exemplo n.º 3
0
        public void GivenIProvideAnInvalidToken(string invalidToken)
        {
            var wc = new WebClientHelper(TOKEN, invalidToken);

            SetScenarioContextWebClients(new List<WebClientHelper> { wc });
        }