Exemple #1
0
        private void InitializeGridOptionsFromConfiguration(dynamic options, Type testClassType, string testName)
        {
            if (ConfigurationService.GetSection <WebSettings>().ExecutionSettings.Arguments == null)
            {
                return;
            }

            var args = ConfigurationService.GetSection <WebSettings>().ExecutionSettings?.Arguments;

            if (args.Any())
            {
                if (ConfigurationService.GetSection <WebSettings>().ExecutionSettings.ExecutionType.ToLower().Contains("lambda"))
                {
                    var ltOptions = new Dictionary <string, object>();
                    foreach (var item in ConfigurationService.GetSection <WebSettings>().ExecutionSettings.Arguments[0])
                    {
                        if (!string.IsNullOrEmpty(item.Key) && !string.IsNullOrEmpty(item.Value))
                        {
                            ltOptions.Add(item.Key, FormatGridOptions(item.Value, testClassType));
                        }
                    }

                    ltOptions.Add("build", TimestampBuilder.GenerateUniqueTextMonthNameOneWord());
                    ltOptions.Add("name", testName);
                    options.AddAdditionalOption("LT:Options", ltOptions);
                }
                else
                {
                    foreach (var item in ConfigurationService.GetSection <WebSettings>().ExecutionSettings.Arguments[0])
                    {
                        if (item.Key.ToLower().Equals("browserversion"))
                        {
                            options.BrowserVersion = item.Value;
                        }
                        else if (item.Key.ToLower().Equals("platformname"))
                        {
                            options.PlatformName = item.Value;
                        }
                        else if (!string.IsNullOrEmpty(item.Key) && !string.IsNullOrEmpty(item.Value))
                        {
                            options.AddAdditionalCapability(item.Key, FormatGridOptions(item.Value, testClassType), true);
                        }
                    }

                    options.AddAdditionalCapability("name", testName);
                }
            }
        }
        /// <summary>
        /// Signs the package with a timestamp.
        /// </summary>
        /// <param name="timestampServer">The URI of the timestamp server.</param>
        /// <param name="timestampAlgorithm">The hash algorithm to timestamp with.</param>
        /// <returns>A result of the timestamp operation.</returns>
        public async Task <TimestampResult> SignAsync(Uri timestampServer, HashAlgorithmName timestampAlgorithm)
        {
            if (timestampServer == null)
            {
                throw new ArgumentNullException(nameof(timestampServer));
            }
            if (!timestampServer.IsAbsoluteUri)
            {
                throw new ArgumentException("The timestamp server must be an absolute URI.", nameof(timestampServer));
            }
            var nonce = TimestampNonce.Generate();

            var(document, signature) = GetSignatureToTimestamp(_part);
            var(result, timestamp)   = await TimestampBuilder.RequestTimestamp(timestampServer, timestampAlgorithm, nonce, Timeout, signature);

            if (result == TimestampResult.Success)
            {
                ApplyTimestamp(document, _part, timestamp);
            }
            return(result);
        }
 public virtual string GetUniqueFileName(string name) => string.Concat(TimestampBuilder.BuildUniqueText(name), ".png");