Пример #1
0
        public CommandLineApplication <MainApp> InitApp(ISpeechServicesAPIv20 apiObject)
        {
            var services = new ServiceCollection()
                           .AddSingleton <IConfig, Config>()
                           .AddSingleton <ISpeechServicesAPIv20>(apiObject)
                           .BuildServiceProvider();

            var writer = new MockTestWriter();
            var app    = new CommandLineApplication <MainApp>(new MockConsole(writer));

            app.Conventions.UseDefaultConventions().UseConstructorInjection(services);

            return(app);
        }
Пример #2
0
        public CommandLineApplication <MainApp> InitApp(IMicrosoftCustomTranslatorAPIPreview10 apiObject)
        {
            var services = new ServiceCollection()
                           .AddSingleton <IConfig, Config>()
                           .AddSingleton <IConfiguration>(new ConfigurationBuilder().Build())
                           .AddSingleton <IMicrosoftCustomTranslatorAPIPreview10>(apiObject)
                           .AddSingleton <IAccessTokenClient>(new MockAccessTokenClient())
                           .BuildServiceProvider();

            var writer = new MockTestWriter();
            var app    = new CommandLineApplication <MainApp>(new MockConsole(writer));

            app.Conventions.UseDefaultConventions().UseConstructorInjection(services);

            return(app);
        }