Beispiel #1
0
        public async Task CanCreate_should_throw_exception_if_action_null()
        {
            var command = CreateCommand(new CreateRule
            {
                Trigger = new ContentChangedTrigger
                {
                    Schemas = ImmutableList <ContentChangedTriggerSchema> .Empty
                },
                Action = null
            });

            await Assert.ThrowsAsync <ValidationException>(() => GuardRule.CanCreate(command, appProvider));
        }
Beispiel #2
0
        public async Task CanCreate_should_throw_exception_if_trigger_null()
        {
            var command = CreateCommand(new CreateRule
            {
                Trigger = null,
                Action  = new WebhookAction
                {
                    Url = validUrl
                }
            });

            await Assert.ThrowsAsync <ValidationException>(() => GuardRule.CanCreate(command, appProvider));
        }
        public async Task CanCreate_should_throw_exception_if_trigger_null()
        {
            var command = CreateCommand(new CreateRule
            {
                Trigger = null,
                Action  = new TestAction
                {
                    Url = validUrl
                }
            });

            await ValidationAssert.ThrowsAsync(() => GuardRule.CanCreate(command, appProvider),
                                               new ValidationError("Trigger is required.", "Trigger"));
        }
Beispiel #4
0
        public async Task CanCreate_should_throw_exception_if_action_null()
        {
            var command = CreateCommand(new CreateRule
            {
                Trigger = new ContentChangedTrigger
                {
                    Schemas = ReadOnlyCollection.Empty <ContentChangedTriggerSchema>()
                },
                Action = null
            });

            await ValidationAssert.ThrowsAsync(() => GuardRule.CanCreate(command, appProvider),
                                               new ValidationError("Action is required.", "Action"));
        }
Beispiel #5
0
        public async Task CanCreate_should_not_throw_exception_if_trigger_and_action_valid()
        {
            var command = CreateCommand(new CreateRule
            {
                Trigger = new ContentChangedTrigger
                {
                    Schemas = ImmutableList <ContentChangedTriggerSchema> .Empty
                },
                Action = new WebhookAction
                {
                    Url = validUrl
                }
            });

            await GuardRule.CanCreate(command, appProvider);
        }
Beispiel #6
0
        public async Task CanCreate_should_not_throw_exception_if_trigger_and_action_valid()
        {
            var command = CreateCommand(new CreateRule
            {
                Trigger = new ContentChangedTrigger
                {
                    Schemas = ReadOnlyCollection.Empty <ContentChangedTriggerSchema>()
                },
                Action = new TestAction
                {
                    Url = validUrl
                }
            });

            await GuardRule.CanCreate(command, appProvider);
        }