public async Task CanUpdate_should_throw_exception_if_action_and_trigger_are_null()
        {
            var command = new UpdateRule();

            await ValidationAssert.ThrowsAsync(() => GuardRule.CanUpdate(command, appId.Id, appProvider),
                                               new ValidationError("Either trigger or action is required.", "Trigger", "Action"));
        }
Beispiel #2
0
        public async Task CanUpdate_should_not_throw_exception_if_rule_has_already_this_name()
        {
            var command = new UpdateRule {
                Name = "MyName"
            };

            await GuardRule.CanUpdate(command, Rule(), appProvider);
        }
Beispiel #3
0
        public async Task CanUpdate_should_throw_exception_if_rule_has_already_this_name()
        {
            var command = new UpdateRule
            {
                Name = "MyName"
            };

            await ValidationAssert.ThrowsAsync(() => GuardRule.CanUpdate(command, appId.Id, appProvider, rule_0),
                                               new ValidationError("Rule has already this name.", "Name"));
        }
Beispiel #4
0
        public async Task CanUpdate_should_not_throw_exception_if_trigger_and_action_valid()
        {
            var command = CreateCommand(new UpdateRule
            {
                Trigger = new ContentChangedTrigger
                {
                    Schemas = ImmutableList <ContentChangedTriggerSchema> .Empty
                },
                Action = new WebhookAction
                {
                    Url = validUrl
                }
            });

            await GuardRule.CanUpdate(command, appProvider);
        }
Beispiel #5
0
        public async Task CanUpdate_should_not_throw_exception_if_trigger_and_action_valid()
        {
            var command = new UpdateRule
            {
                Trigger = new ContentChangedTrigger
                {
                    Schemas = ReadOnlyCollection.Empty <ContentChangedTriggerSchema>()
                },
                Action = new TestAction
                {
                    Url = validUrl
                }
            };

            await GuardRule.CanUpdate(command, appId.Id, appProvider);
        }
Beispiel #6
0
        public async Task CanUpdate_should_not_throw_exception_if_trigger_action__and_name_are_valid()
        {
            var command = new UpdateRule
            {
                Trigger = new ContentChangedTriggerV2
                {
                    Schemas = ReadOnlyCollection.Empty <ContentChangedTriggerSchemaV2>()
                },
                Action = new TestAction
                {
                    Url = validUrl
                },
                Name = "NewName"
            };

            await GuardRule.CanUpdate(command, Rule(), appProvider);
        }
Beispiel #7
0
        public async Task CanUpdate_should_throw_exception_if_action_and_trigger_are_null()
        {
            var command = new UpdateRule();

            await Assert.ThrowsAsync <ValidationException>(() => GuardRule.CanUpdate(command, appProvider));
        }
Beispiel #8
0
        public async Task CanUpdate_should_not_throw_exception_if_all_properties_are_null()
        {
            var command = new UpdateRule();

            await GuardRule.CanUpdate(command, Rule(), appProvider);
        }