Пример #1
0
        protected virtual void Map(DriverJsonSection section, RemoteDriverAtataContextBuilder builder)
        {
            if (!string.IsNullOrWhiteSpace(section.Alias))
            {
                builder.WithAlias(section.Alias);
            }

            if (section.CommandTimeout != null)
            {
                builder.WithCommandTimeout(TimeSpan.FromSeconds(section.CommandTimeout.Value));
            }

            if (!string.IsNullOrWhiteSpace(section.RemoteAddress))
            {
                builder.WithRemoteAddress(section.RemoteAddress);
            }

            if (section.Options != null)
            {
                builder.WithOptions(() => CreateOptions(section.Options));
            }
        }
Пример #2
0
        protected virtual void Map(DriverJsonSection section, TBuilder builder)
        {
            if (!string.IsNullOrWhiteSpace(section.Alias))
            {
                builder.WithAlias(section.Alias);
            }

            if (section.CommandTimeout != null)
            {
                builder.WithCommandTimeout(TimeSpan.FromSeconds(section.CommandTimeout.Value));
            }

            if (section.PortsToIgnore?.Any() ?? false)
            {
                builder.WithPortsToIgnore(section.PortsToIgnore);
            }

            if (!string.IsNullOrWhiteSpace(section.Service?.DriverPath))
            {
                builder.WithDriverPath(FormatDriverPath(section.Service.DriverPath));
            }

            if (!string.IsNullOrWhiteSpace(section.Service?.DriverExecutableFileName))
            {
                builder.WithDriverExecutableFileName(section.Service.DriverExecutableFileName);
            }

            if (section.Options != null)
            {
                builder.WithOptions(opt => MapOptions(section.Options, opt));
            }

            if (section.Service != null)
            {
                builder.WithDriverService(srv => MapService(section.Service, srv));
            }
        }
Пример #3
0
        public void Map(DriverJsonSection section, AtataContextBuilder builder)
        {
            RemoteDriverAtataContextBuilder driverBuilder = CreateDriverBuilder(builder);

            Map(section, driverBuilder);
        }
        private static void MapDriver(DriverJsonSection section, AtataContextBuilder builder)
        {
            IDriverJsonMapper mapper = DriverJsonMapperAliases.Resolve(section.Type);

            mapper.Map(section, builder);
        }