Beispiel #1
0
 public HomeController(ILogger <HomeController> logger, IPlayerService playerService, ISteamService steamService, IEnvironmentVariablesService environmentVariablesService)
 {
     _logger        = logger ?? throw new ArgumentNullException(nameof(logger));
     _playerService = playerService ?? throw new ArgumentNullException(nameof(playerService));
     _steamService  = steamService ?? throw new ArgumentNullException(nameof(steamService));
     _environmentVariablesService = environmentVariablesService ?? throw new ArgumentNullException(nameof(environmentVariablesService));
 }
 /// <summary>
 /// Creates a new CLI output usage printer
 /// </summary>
 /// <param name="console"></param>
 /// <param name="container"></param>
 /// <param name="builder"></param>
 /// <param name="environmentVariablesService"></param>
 /// <param name="suggestionProvider"></param>
 public UsagePrinter(IConsole console, ICommandLineCommandContainer container, IUsageBuilder builder, IEnvironmentVariablesService environmentVariablesService, ISuggestionProvider suggestionProvider)
 {
     this.console = console ?? throw new ArgumentNullException(nameof(console));
     Container    = container ?? throw new ArgumentNullException(nameof(container));
     Builder      = builder ?? throw new ArgumentNullException(nameof(builder));
     this.environmentVariablesService = environmentVariablesService ?? throw new ArgumentNullException(nameof(environmentVariablesService));
     this.suggestionProvider          = suggestionProvider ?? throw new ArgumentNullException(nameof(suggestionProvider));
 }
 public ProjectsController(IProjectService projectService,
                           IBuildOperationsService builder,
                           IEnvironmentVariablesService envService,
                           IBuildService buildService)
 {
     _builder        = builder;
     _envService     = envService;
     _projectService = projectService;
     _buildService   = buildService;
 }
        public NoColorOutputTests(ITestOutputHelper output) : base(output)
        {
            var envMock = new Mock <IEnvironmentVariablesService>();

            envMock.SetupGet(env => env.NoColorRequested).Returns(() => variableServiceResult);

            var consoleMock = new Mock <IConsole>();

            variablesService = envMock.Object;

            var usageBuilderMock = new Mock <IUsageBuilder>();

            usageBuilderMock.Setup(m => m.AddErrors(It.IsAny <IReadOnlyCollection <Exception> >())).Callback(() =>
            {
                consoleColorGetter(consoleMock.Object.ForegroundColor);
            });

            Services.AddSingleton(envMock.Object);
            Services.AddSingleton(consoleMock.Object);
            Services.AddSingleton(usageBuilderMock.Object);

            parser = new CommandLineParser <Options>(Services);
        }
 public MyCommandWithInjections(IMyService service, IUsagePrinter usagePrinter, IEnvironmentVariablesService environment)
 {
     this.service      = service ?? throw new System.ArgumentNullException(nameof(service));
     this.usagePrinter = usagePrinter ?? throw new System.ArgumentNullException(nameof(usagePrinter));
     this.environment  = environment ?? throw new System.ArgumentNullException(nameof(environment));
 }
 public SteamService(ILogger <SteamService> logger, HttpClient client, IEnvironmentVariablesService environmentVariablesService)
 {
     _logger = logger ?? throw new ArgumentNullException(nameof(logger));
     _client = client ?? throw new ArgumentNullException(nameof(client));
     _environmentVariablesService = environmentVariablesService ?? throw new ArgumentNullException(nameof(environmentVariablesService));
 }