Beispiel #1
0
        public void Should_return_false_when_trigger_contains_no_schemas()
        {
            var trigger = new ContentChangedTrigger();

            var result = sut.Triggers(new Envelope <AppEvent>(new ContentCreated()), trigger);

            Assert.False(result);
        }
Beispiel #2
0
        public async Task Should_not_create_if_not_triggered()
        {
            var ruleConfig   = ValidRule();
            var ruleEnvelope = Envelope.Create(new ContentCreated());

            A.CallTo(() => ruleTriggerHandler.Triggers(A <Envelope <AppEvent> > .Ignored, ruleConfig.Trigger))
            .Returns(false);

            var job = await sut.CreateJobAsync(ruleConfig, ruleEnvelope);

            Assert.Null(job);
        }
Beispiel #3
0
        public void Should_not_create_if_not_triggered()
        {
            var ruleConfig   = new Rule(new ContentChangedTrigger(), new InvalidAction());
            var ruleEnvelope = Envelope.Create(new ContentCreated());

            A.CallTo(() => ruleTriggerHandler.Triggers(A <Envelope <AppEvent> > .Ignored, ruleConfig.Trigger))
            .Returns(false);

            var job = sut.CreateJob(ruleConfig, ruleEnvelope);

            Assert.Null(job);
        }
Beispiel #4
0
        public void Should_return_result_depending_on_event(int expected, int sendCreate, int sendUpdate, int sendRename, int sendDelete, AppEvent @event)
        {
            var trigger = new AssetChangedTrigger
            {
                SendCreate = sendCreate == 1,
                SendUpdate = sendUpdate == 1,
                SendRename = sendRename == 1,
                SendDelete = sendDelete == 1
            };

            var result = sut.Triggers(new Envelope <AppEvent>(@event), trigger);

            Assert.Equal(expected == 1, result);
        }