Exemplo n.º 1
0
        public void CanPatch_should_throw_exception_if_data_is_null()
        {
            var command = new PatchContent();

            ValidationAssert.Throws(() => GuardContent.CanPatch(command),
                                    new ValidationError("Data is required.", "Data"));
        }
Exemplo n.º 2
0
        public async Task CanCreate_should_throw_exception_if_data_is_null()
        {
            var command = new CreateContent();

            await ValidationAssert.ThrowsAsync(() => GuardContent.CanCreate(schema, contentWorkflow, command),
                                               new ValidationError("Data is required.", "Data"));
        }
Exemplo n.º 3
0
        public void CreateDraft_should_not_throw_exception()
        {
            var content = CreateContent(Status.Published);
            var command = new CreateContentDraft();

            GuardContent.CanCreateDraft(command, content);
        }
Exemplo n.º 4
0
        public void CanDeleteDraft_should_not_throw_exception()
        {
            var content = CreateDraftContent(Status.Draft);
            var command = new DeleteContentDraft();

            GuardContent.CanDeleteDraft(command, content);
        }
Exemplo n.º 5
0
        public void CanCreate_should_throw_exception_if_data_is_null()
        {
            var command = new CreateContent();

            ValidationAssert.Throws(() => GuardContent.CanCreate(schema, command),
                                    new ValidationError("Data is required.", "Data"));
        }
Exemplo n.º 6
0
        public void CanDelete_should_throw_exception_if_singleton()
        {
            A.CallTo(() => schema.IsSingleton).Returns(true);

            var command = new DeleteContent();

            Assert.Throws <DomainException>(() => GuardContent.CanDelete(schema, command));
        }
Exemplo n.º 7
0
        public void CanChangeContentStatus_should_not_throw_exception_if_publishing_with_pending_changes()
        {
            var command = new ChangeContentStatus {
                Status = Status.Published
            };

            GuardContent.CanChangeContentStatus(true, Status.Published, command);
        }
Exemplo n.º 8
0
        public void CanDelete_should_throw_exception_if_singleton()
        {
            var schema = CreateSchema(true);

            var command = new DeleteContent();

            Assert.Throws <DomainException>(() => GuardContent.CanDelete(schema, command));
        }
Exemplo n.º 9
0
        public void CanDelete_should_not_throw_exception()
        {
            SetupSingleton(false);

            var command = new DeleteContent();

            GuardContent.CanDelete(schema, command);
        }
Exemplo n.º 10
0
        public void CanChangeContentStatus_should_throw_exception_if_status_flow_not_valid()
        {
            var command = new ChangeContentStatus {
                Status = Status.Published
            };

            Assert.Throws <ValidationException>(() => GuardContent.CanChangeContentStatus(false, Status.Archived, command));
        }
Exemplo n.º 11
0
        public void CanCreate_should_not_throw_exception_if_data_is_not_null()
        {
            var command = new CreateContent {
                Data = new NamedContentData()
            };

            GuardContent.CanCreate(command);
        }
Exemplo n.º 12
0
        public async Task CanCreate_should_not_throw_exception_if_data_is_not_null()
        {
            var command = new CreateContent {
                Data = new NamedContentData()
            };

            await GuardContent.CanCreate(schema, contentWorkflow, command);
        }
Exemplo n.º 13
0
        public void CanChangeContentStatus_should_throw_exception_if_due_date_in_past()
        {
            var command = new ChangeContentStatus {
                Status = Status.Published, DueTime = dueTimeInPast
            };

            Assert.Throws <ValidationException>(() => GuardContent.CanChangeContentStatus(false, Status.Draft, command));
        }
Exemplo n.º 14
0
        public void CanPatch_should_not_throw_exception_if_data_is_not_null()
        {
            var command = new PatchContent {
                Data = new NamedContentData()
            };

            GuardContent.CanPatch(command);
        }
Exemplo n.º 15
0
        public void CanDiscardChanges_should_not_throw_exception_if_pending()
        {
            SetupSingleton(false);

            var command = new DiscardChanges();

            GuardContent.CanDiscardChanges(true, command);
        }
Exemplo n.º 16
0
        public void CanChangeContentStatus_should_not_throw_exception_if_status_flow_valid()
        {
            var command = new ChangeContentStatus {
                Status = Status.Published
            };

            GuardContent.CanChangeContentStatus(false, Status.Draft, command);
        }
Exemplo n.º 17
0
        public void CanDelete_should_not_throw_exception()
        {
            var schema = CreateSchema(false);

            var command = new DeleteContent();

            GuardContent.CanDelete(schema, command);
        }
Exemplo n.º 18
0
        public void CanChangeContentStatus_should_throw_exception_if_publishing_without_pending_changes()
        {
            var command = new ChangeContentStatus {
                Status = Status.Published
            };

            Assert.Throws <ValidationException>(() => GuardContent.CanChangeContentStatus(false, Status.Published, command));
        }
Exemplo n.º 19
0
        public void CanChangeContentStatus_should_throw_exception_if_publishing_without_pending_changes()
        {
            var command = new ChangeContentStatus {
                Status = Status.Published
            };

            ValidationAssert.Throws(() => GuardContent.CanChangeContentStatus(schema, false, Status.Published, command),
                                    new ValidationError("Content has no changes to publish.", "Status"));
        }
Exemplo n.º 20
0
        public void CanChangeContentStatus_should_throw_exception_if_status_not_valid()
        {
            var command = new ChangeContentStatus {
                Status = (Status)10
            };

            ValidationAssert.Throws(() => GuardContent.CanChangeContentStatus(schema, false, Status.Archived, command),
                                    new ValidationError("Status is not valid.", "Status"));
        }
Exemplo n.º 21
0
        public void CanDeleteDraft_should_throw_exception_if_no_draft_found()
        {
            CreateSchema(false);

            var content = new ContentState();
            var command = new DeleteContentDraft();

            Assert.Throws <DomainException>(() => GuardContent.CanDeleteDraft(command, content));
        }
Exemplo n.º 22
0
        public void CanChangeContentStatus_should_throw_exception_if_status_flow_not_valid()
        {
            var command = new ChangeContentStatus {
                Status = Status.Published
            };

            ValidationAssert.Throws(() => GuardContent.CanChangeContentStatus(schema, false, Status.Archived, command),
                                    new ValidationError("Cannot change status from Archived to Published.", "Status"));
        }
Exemplo n.º 23
0
        public void CreateDraft_should_throw_exception_if_not_published()
        {
            CreateSchema(false);

            var content = CreateContent(Status.Draft);
            var command = new CreateContentDraft();

            Assert.Throws <DomainException>(() => GuardContent.CanCreateDraft(command, content));
        }
Exemplo n.º 24
0
        public void CanDeleteDraft_should_throw_exception_if_singleton()
        {
            var schema = CreateSchema(true);

            var content = CreateDraftContent(Status.Draft);
            var command = new DeleteContentDraft();

            Assert.Throws <DomainException>(() => GuardContent.CanDeleteDraft(command, schema, content));
        }
Exemplo n.º 25
0
        public void CanChangeContentStatus_should_throw_exception_if_due_date_in_past()
        {
            var command = new ChangeContentStatus {
                Status = Status.Published, DueTime = dueTimeInPast
            };

            ValidationAssert.Throws(() => GuardContent.CanChangeContentStatus(schema, false, Status.Draft, command),
                                    new ValidationError("Due time must be in the future.", "DueTime"));
        }
Exemplo n.º 26
0
        public async Task CanDelete_should_not_throw_exception()
        {
            var schema = CreateSchema(false);

            var content = CreateContent(Status.Published);
            var command = new DeleteContent();

            await GuardContent.CanDelete(command, content, contentRepository, schema);
        }
Exemplo n.º 27
0
        public void CanUpdate_should_throw_exception_if_data_is_null()
        {
            SetupSingleton(false);

            var command = new UpdateContent();

            ValidationAssert.Throws(() => GuardContent.CanUpdate(command),
                                    new ValidationError("Data is required.", "Data"));
        }
Exemplo n.º 28
0
        public async Task CanDelete_should_throw_exception_if_singleton()
        {
            var schema = CreateSchema(true);

            var content = CreateContent(Status.Published);
            var command = new DeleteContent();

            await Assert.ThrowsAsync <DomainException>(() => GuardContent.CanDelete(command, content, contentRepository, schema));
        }
Exemplo n.º 29
0
        public async Task CanCreate_should_not_throw_exception_if_singleton_and_id_is_schema_id()
        {
            var schema = CreateSchema(true);

            var command = new CreateContent {
                Data = new NamedContentData(), ContentId = schema.Id
            };

            await GuardContent.CanCreate(schema, contentWorkflow, command);
        }
Exemplo n.º 30
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(schema, contentWorkflow, command));
        }