Example #1
0
        public void CanCreate_should_throw_exception_if_data_is_null()
        {
            var command = new CreateContent();

            ValidationAssert.Throws(() => GuardContent.CanCreate(command, schema),
                                    new ValidationError("Data is required.", "Data"));
        }
Example #2
0
        public async Task CanCreate_should_throw_exception_if_data_is_null()
        {
            var command = new CreateContent();

            await ValidationAssert.ThrowsAsync(() => GuardContent.CanCreate(command, workflow, schema),
                                               new ValidationError("Data is required.", "Data"));
        }
Example #3
0
        public void CanCreate_should_not_throw_exception_if_data_is_not_null()
        {
            var command = new CreateContent {
                Data = new ContentData()
            };

            GuardContent.CanCreate(command, schema);
        }
Example #4
0
        public void CanCreate_should_not_throw_exception_if_singleton_and_id_is_schema_id()
        {
            var command = new CreateContent {
                Data = new ContentData(), ContentId = schema.Id
            };

            GuardContent.CanCreate(command, schema);
        }
Example #5
0
        public void CanCreate_should_throw_exception_if_singleton()
        {
            var command = new CreateContent {
                Data = new ContentData()
            };

            Assert.Throws <DomainException>(() => GuardContent.CanCreate(command, singleton));
        }
Example #6
0
        public async Task CanCreate_should_not_throw_exception_if_singleton_and_id_is_schema_id()
        {
            var command = new CreateContent {
                Data = new ContentData(), ContentId = schema.Id
            };

            await GuardContent.CanCreate(command, workflow, schema);
        }
Example #7
0
        public async Task CanCreate_should_throw_exception_if_singleton()
        {
            var command = new CreateContent {
                Data = new ContentData()
            };

            await Assert.ThrowsAsync <DomainException>(() => GuardContent.CanCreate(command, workflow, singleton));
        }
Example #8
0
        public async Task CanCreate_should_not_throw_exception_if_data_is_not_null()
        {
            var command = new CreateContent {
                Data = new ContentData()
            };

            await GuardContent.CanCreate(command, workflow, schema);
        }
Example #9
0
        public async Task CanCreate_should_not_throw_exception_if_publishing_allowed()
        {
            SetupCanCreatePublish(true);

            var command = new CreateContent {
                Data = new ContentData(), Publish = true
            };

            await Assert.ThrowsAsync <DomainException>(() => GuardContent.CanCreate(command, workflow, schema));
        }
Example #10
0
        public async Task CanCreate_should_throw_exception_if_singleton()
        {
            var schema = CreateSchema(true);

            var command = new CreateContent {
                Data = new NamedContentData()
            };

            await Assert.ThrowsAsync <DomainException>(() => GuardContent.CanCreate(command, contentWorkflow, schema));
        }
Example #11
0
        public async Task CanCreate_should_not_throw_exception_publishing_allowed()
        {
            var schema = CreateSchema(false);

            SetupCanCreatePublish(schema, true);

            var command = new CreateContent {
                Data = new NamedContentData(), Publish = true
            };

            await Assert.ThrowsAsync <DomainException>(() => GuardContent.CanCreate(command, contentWorkflow, schema));
        }