Пример #1
0
        static void CallChildThread(Resources context, ref Logger logger, int threadCount)
        {
            string      x = "";
            SalesValues values;
            int         loopCount = 100;

            List <String> logs = new List <string>();

            int threadId = Thread.CurrentThread.ManagedThreadId;

            context.BuildingRequest += (sender, e) =>
            {
                var uriBuilder = new UriBuilder(e.RequestUri);
                // Requires a reference to System.Web and .NET 4.6.1+
                var paramValues = HttpUtility.ParseQueryString(uriBuilder.Query);
                if (paramValues.GetValues("cross-company") == null)
                {
                    paramValues.Add("cross-company", "true");
                    uriBuilder.Query = paramValues.ToString();
                    e.RequestUri     = uriBuilder.Uri;
                }
            };

            context.SendingRequest2 += new EventHandler <SendingRequest2EventArgs>(delegate(object sender, SendingRequest2EventArgs e)
            {
                var authenticationHeader = OAuthHelper.GetAuthenticationHeader(useWebAppAuthentication: true);
                e.RequestMessage.SetHeader(OAuthHelper.OAuthHeader, authenticationHeader);
            });


            for (int i = 0; i < loopCount; i++)
            {
                values = SalesOrderHeaderV2Tester.getRandomCombination();
                logs.Add(SalesOrderHeaderV2Tester.runOneReadThread(context, threadCount, filePath, SalesOrderTester.TestType.Random, SalesOrderTester.TestWorkload.ReadThread, values.SalesId, values.DataAreaId));
            }


            logger.addList(logs);
        }