Ejemplo n.º 1
0
        public void Setup()
        {
            var rule = Substitute.For <IValidationRule>();

            rule.GetConfiguration().Returns(new Dictionary <string, string>
            {
                { "ClassName", "GoodTestClassName" },
                { "PullRequestTitle", "GoodTestTitle" },
                { "ReadMeTemplateFileLocation", "GoodTestLocation.md" },
                { "MainBranch", "GoodTestBranch" }
            });
            var rule2 = Substitute.For <IValidationRule>();

            rule2.GetConfiguration().Returns(new Dictionary <string, string>
            {
                { "ClassName", "BadTestClassName" },
                { "PullRequestTitle", "BadTestTitle" },
                { "ReadMeTemplateFileLocation", "BadTestLocation.md" },
                { "MainBranch", "BadTestBranch" }
            });

            var rules = new[] { rule, rule2 };

            _validator = Substitute.For <IRepositoryValidator>();
            _validator.Rules.Returns(rules);
            _statusEndpoint = new StatusEndpoint(Substitute.For <ILogger <StatusEndpoint> >(), _validator);
        }
 public StatusEndpoint(ILogger <StatusEndpoint> logger, IRepositoryValidator validator)
 {
     _logger    = logger ?? throw new ArgumentNullException(nameof(logger));
     _validator = validator ?? throw new ArgumentNullException(nameof(validator));
 }
Ejemplo n.º 3
0
 public FileReader(IRepositoryValidator repositoryValidator)
 {
     _repositoryValidator = repositoryValidator;
 }
 public ValidationClient(IGitHubClient client, IRepositoryValidator validator)
 {
     _client    = client ?? throw new ArgumentNullException(nameof(client));
     _validator = validator ?? throw new ArgumentNullException(nameof(validator));
 }