public void NotExecuteAnything_WhenRuleIsNotMatched()
        {
            // Arrange
            var processExecutor = new Mock <IProcessExecutor>();
            var ruleMatcher     = new Mock <IRuleMatcher>();

            ruleMatcher
            .Setup(x =>
                   x.Match("something", "url"))
            .Returns((WebHookRule)null);

            var sup = new PushEventProcessor(processExecutor.Object, ruleMatcher.Object, new NullLogger <PushEventProcessor>());

            // Act
            var result = sup.Process(new PushEventPayload
            {
                Ref = "something", Repository = new Repository {
                    Url = "url"
                }
            });

            // Assert
            result.Should().BeFalse();
            ruleMatcher.Verify();
            processExecutor.Verify(x => x.Execute(It.IsAny <string>()), Times.Never);
        }
        public void ExecuteScript_WhenRuleIsMatched()
        {
            // Arrange
            var processExecutor = new Mock <IProcessExecutor>();
            var ruleMatcher     = new Mock <IRuleMatcher>();

            ruleMatcher
            .Setup(x =>
                   x.Match("something", "url"))
            .Returns(new WebHookRule
            {
                Execute = "exe"
            });

            processExecutor.Setup(x => x.Execute("exe"));

            var sup = new PushEventProcessor(processExecutor.Object, ruleMatcher.Object, new NullLogger <PushEventProcessor>());

            // Act
            var result = sup.Process(new PushEventPayload
            {
                Ref = "something", Repository = new Repository {
                    Url = "url"
                }
            });

            // Assert
            result.Should().BeTrue();
            ruleMatcher.Verify();
            processExecutor.Verify();
        }