Ejemplo n.º 1
0
        public void Parse_WithZeroArgs_ShouldParse()
        {
            string[] args = new string[0];

            var parameters = parser.Parse(args);

            Assert.NotNull(parameters);
        }
        internal void Initialize(IFileSystem fileSystem, IEventSource eventSource,
                                 IEnvironmentProvider environmentProvider, ISubmissionService submissionService,
                                 IParameterParser parameterParser, ILogDataBuilderFactory logDataBuilderFactory)
        {
            _environmentProvider = environmentProvider;
            _parameters          = parameterParser.Parse(Parameters);

            if (string.IsNullOrWhiteSpace(_parameters.Token))
            {
                _environmentProvider.WriteLine("BuildCrossCheck Token is not present");
                return;
            }

            if (string.IsNullOrWhiteSpace(_parameters.CloneRoot))
            {
                _environmentProvider.WriteLine("BuildCrossCheck CloneRoot is not present");
                return;
            }

            if (string.IsNullOrWhiteSpace(_parameters.Owner))
            {
                _environmentProvider.WriteLine("BuildCrossCheck Owner is not present");
                return;
            }

            if (string.IsNullOrWhiteSpace(_parameters.Repo))
            {
                _environmentProvider.WriteLine("BuildCrossCheck Repo is not present");
                return;
            }

            if (string.IsNullOrWhiteSpace(_parameters.Hash))
            {
                _environmentProvider.WriteLine("BuildCrossCheck Hash is not present");
                return;
            }

            if (!_parameters.PullRequestNumber.HasValue)
            {
                _environmentProvider.WriteLine("BuildCrossCheck PullRequestNumber is not present");
                return;
            }

            _environmentProvider.WriteLine("BuildCrossCheck Enabled");

            _configuration  = LoadCheckRunConfiguration(fileSystem, _parameters.ConfigurationFile);
            _logDataBuilder = logDataBuilderFactory.BuildLogDataBuilder(_parameters, _configuration);

            _submissionService = submissionService;

            eventSource.BuildStarted  += EventSourceOnBuildStarted;
            eventSource.BuildFinished += EventSourceOnBuildFinished;
            eventSource.WarningRaised += EventSourceOnWarningRaised;
            eventSource.ErrorRaised   += EventSourceOnErrorRaised;
        }