Esempio n. 1
0
 private void Remove()
 {
     if (!Candidates.Any(c => c.IsChecked))
     {
         return;
     }
     _dialogService.Show(
         "Question",
         "Are you sure you want to remove the selected candidates?",
         DialogType.Question,
         true,
         true,
         r =>
     {
         if (r)
         {
             IsBusy = true;
             var requestDispatcher = _asyncRequestDispatcherFactory.CreateAsyncRequestDispatcher();
             foreach (var candidate in Candidates.Where(c => c.IsChecked))
             {
                 requestDispatcher.Add(Guid.NewGuid().ToString(), new RemoveCandidateRequest
                 {
                     Id = candidate.Id
                 });
             }
             requestDispatcher.ProcessRequests(res => Load(), e => IsBusy = false);
         }
     });
 }
Esempio n. 2
0
        public async Task FindSimulatorAsync()
        {
            if (Device != null)
            {
                return;
            }

            var asyncEnumerable = Candidates as IAsyncEnumerable;

            if (asyncEnumerable != null)
            {
                await asyncEnumerable.ReadyTask;
            }

            if (!Candidates.Any())
            {
                ExecutionResult = TestExecutingResult.DeviceNotFound;
                FailureMessage  = "No applicable devices found.";
            }
            else
            {
                Device = Candidates.First();
                if (Platform == TestPlatform.watchOS)
                {
                    CompanionDevice = simulators.FindCompanionDevice(Jenkins.SimulatorLoadLog, Device);
                }
            }
        }
        public BenchmarkReport Go()
        {
            if (Candidates?.Any() != true)
            {
                throw new ArgumentException($"At least one {nameof(IBenchmarkCandidate<TContext>)} must be provided");
            }

            if (BenchmarkTestContexts?.Any() != true)
            {
                throw new ArgumentException($"At least one {nameof(TContext)} must be provided");
            }

            if (FixedNumberOfRuns < 1)
            {
                throw new ArgumentException($"{nameof(NumberOfRuns)} must be greater than zero");
            }

            return(new CandidateRunner <TContext>(this).Run());
        }
        internal RequestHandler Build()
        {
            var feature          = HttpContext.Features.Get <IApiVersioningFeature>();
            var request          = HttpContext.Request;
            var method           = request.Method;
            var requestedVersion = feature.RawRequestedApiVersion;
            var parsedVersion    = feature.RequestedApiVersion;
            var actionNames      = new Lazy <string>(() => Join(NewLine, Candidates.Select(a => a.DisplayName)));
            var allowedMethods   = new Lazy <HashSet <string> >(() => AllowedMethodsFromCandidates(Candidates, parsedVersion));
            var apiVersions      = new Lazy <ApiVersionModel>(Candidates.Select(a => a.GetApiVersionModel()).Aggregate);
            var handlerContext   = new RequestHandlerContext(ErrorResponseProvider, ApiVersionReporter, apiVersions);
            var url = new Uri(request.GetDisplayUrl()).SafeFullPath();

            if (parsedVersion == null)
            {
                if (IsNullOrEmpty(requestedVersion))
                {
                    if (Options.AssumeDefaultVersionWhenUnspecified || Candidates.Any(c => c.GetApiVersionModel().IsApiVersionNeutral))
                    {
                        return(VersionNeutralUnmatched(handlerContext, url, method, allowedMethods.Value, actionNames.Value));
                    }

                    return(UnspecifiedApiVersion(handlerContext, actionNames.Value));
                }
                else if (!TryParse(requestedVersion, out parsedVersion))
                {
                    return(MalformedApiVersion(handlerContext, url, requestedVersion));
                }
            }
            else if (IsNullOrEmpty(requestedVersion))
            {
                return(VersionNeutralUnmatched(handlerContext, url, method, allowedMethods.Value, actionNames.Value));
            }
            else
            {
                requestedVersion = parsedVersion.ToString();
            }

            return(Unmatched(handlerContext, url, method, allowedMethods.Value, actionNames.Value, parsedVersion, requestedVersion));
        }