private void InitialiseSingleConnection(ITest test)
 {
     if (test is TestFixture)
     {
         SingleConnectionAuthInfo = SingleConnectionAuthSpec == null
             ? AuthenticationInfoProvider.Current.DefaultAuthInfo
             : AuthenticationInfoProvider.Current.Manager.GetAuthenticationInfo(SingleConnectionAuthSpec);
         var credentials = SingleConnectionAuthInfo.Users.ContainsKey("mainUser")
             ? SingleConnectionAuthInfo.Users["mainUser"]
             : SingleConnectionAuthInfo.Users.First().Value;
         SharedSession = GetClient(test.Id).CreateSession(PrivateAuthentication.WithCredentials(credentials.Company.Name, credentials.Login, credentials.Password));
         SharedSession.Authenticate();
         var connection = new AuthApiConnection();
         if (!((test.Properties.Get(TestCaseExAttribute.SuppressAuthenticationParameterName) as bool?).GetValueOrDefault(false)))
         {
             connection.Authenticate(SharedSession.Authentication().Session);
         }
         else
         {
             connection.SuppressAuthentication = true;
         }
         test.Properties.Add(AuthApiConnectionParameterName, connection);
     }
     else if (test is TestMethod)
     {
         ITest parentFixture = test.Parent;
         while (!(parentFixture is TestFixture))
         {
             parentFixture = parentFixture.Parent;
         }
         test.Properties.Add(AuthApiConnectionParameterName, parentFixture.Properties.Get(AuthApiConnectionParameterName));
     }
 }
        private void DisposeSingleConnection(ITest test)
        {
            if (test is TestFixture)
            {
                if (SingleConnectionAuthSpec != null)
                {
                    SingleConnectionAuthInfo.Dispose();
                }

                SharedSession.Dispose();
            }
        }
Example #3
0
        static void Main(string[] args)
        {
            SharedSession session = new SharedSession();
            // var lineaID=Console.ReadLine();
            //var req= session.Start(lineaID);
            //req.Set("nuevo1", "diego");

            var ss = session.Start("cookie_12345");

            ss["testKey"] = "testValue";
            Console.WriteLine(ss["testKey"]);

            //int idx=0;
            //foreach (var item in "A,B,C,D,E,F,G,H".Split(','))
            //{
            //    idx++;
            //    var key=(item + "_" + idx.ToString());
            //    var value= "Valor " + item;
            //    session[key] = value;
            //    //ss.Set(key,value);

            //}



            //idx = 0;
            //foreach (var item in "A,B,C,D,E,F,G,H".Split(','))
            //{
            //    idx++;
            //    var key = (item + "_" + idx.ToString());
            //    //var value = ss.Get(key);
            //    var value = session[key];

            //    Console.WriteLine("{0} = {1}", key,value.ToString());
            //}


            Console.ReadLine();
        }