コード例 #1
0
        public static bool RequestLoadSimulation(LoadSimulationRequest simulation)
        {
            var request = new RestRequest("api/admin/simulate/orders", Method.POST);

            request.AddJsonBody(simulation);

            return(Execute(request).StatusCode == HttpStatusCode.OK);
        }
コード例 #2
0
        public ActionResult RunTest(string eventId, string tag, int requestsCount)
        {
            var userName = ClaimsPrincipal.Current.GetUserId();
            var email    = ClaimsPrincipal.Current.Identity.Name;

            var simulation = new LoadSimulationRequest
            {
                BaseUrl    = ContosoEventsApi.BaseUrl,
                EventId    = eventId,
                UserName   = string.IsNullOrWhiteSpace(userName) == false ? userName : "******",
                Email      = string.IsNullOrWhiteSpace(email) == false ? email : "no_email",
                Iterations = requestsCount,
                Tag        = tag
            };

            ContosoEventsApi.RequestLoadSimulation(simulation);

            return(RedirectToAction("Index"));
        }