Ejemplo n.º 1
0
        /// <summary>
        /// Gets a new <see cref="IClientBuilder"/> instance, used to fluently construct <see cref="IClient">Client</see> instances.
        /// </summary>
        /// <returns>A new <see cref="IClientBuilder"/> instance.</returns>
        /// <example>
        /// <code>
        /// IClient client = Clients.Builder()
        ///     .SetApiKey(apiKey)
        ///     .Build();
        /// </code>
        /// </example>
        public static IClientBuilder Builder()
        {
            var userAgentBuilder = new UserAgentBuilder(
                Impl.Introspection.Platform.Analyze(),
                Impl.Introspection.Sdk.Anaylze(),
                Impl.Introspection.SourceLanguage.Analyze(System.Reflection.Assembly.GetCallingAssembly()));

            return new DefaultClientBuilder(userAgentBuilder);
        }
        public void UserAgent_is_known()
        {
            var userAgent = new UserAgentBuilder(
                Platform.Analyze(),
                Sdk.Anaylze(),
                SourceLanguage.Analyze(this.GetType().Assembly)).GetUserAgent();

            userAgent.ShouldNotContain("unknown");

            this.output.WriteLine($"UserAgent: {userAgent}");
        }