Example #1
0
        public async Task <IActionResult> UnpublishSchema(string app, string schema)
        {
            var command = new UnpublishSchema();

            var response = await InvokeCommandAsync(command);

            return(Ok(response));
        }
Example #2
0
        public SchemaDomainObject Unpublish(UnpublishSchema command)
        {
            VerifyCreatedAndNotDeleted();

            RaiseEvent(SimpleMapper.Map(command, new SchemaUnpublished()));

            return(this);
        }
Example #3
0
        public void CanUnpublish_should_not_throw_exception_if_already_published()
        {
            var command = new UnpublishSchema();

            var schema_1 = schema_0.Publish();

            GuardSchema.CanUnpublish(schema_1, command);
        }
Example #4
0
        public static void CanUnpublish(Schema schema, UnpublishSchema command)
        {
            Guard.NotNull(command, nameof(command));

            if (!schema.IsPublished)
            {
                throw new DomainException("Schema is not published.");
            }
        }
        protected Task On(UnpublishSchema command, CommandContext context)
        {
            return(handler.UpdateSyncedAsync <SchemaDomainObject>(context, s =>
            {
                GuardSchema.CanUnpublish(s.Snapshot.SchemaDef, command);

                s.Unpublish(command);
            }));
        }
        public SchemaDomainObject Unpublish(UnpublishSchema command)
        {
            Guard.NotNull(command, nameof(command));

            VerifyCreatedAndNotDeleted();

            SchemaGuard.GuardCanUnpublish(schema);

            RaiseEvent(SimpleMapper.Map(command, new SchemaUnpublished()));

            return(this);
        }
Example #7
0
        public async Task Unpublish_should_create_events_and_update_state()
        {
            var command = new UnpublishSchema();

            await ExecuteCreateAsync();
            await ExecutePublishAsync();

            var result = await sut.ExecuteAsync(CreateCommand(command));

            result.ShouldBeEquivalent(new EntitySavedResult(2));

            Assert.False(sut.Snapshot.SchemaDef.IsPublished);

            LastEvents
            .ShouldHaveSameEvents(
                CreateEvent(new SchemaUnpublished())
                );
        }
        public async Task Unpublish_should_create_events_and_update_published_flag()
        {
            var command = new UnpublishSchema();

            await ExecuteCreateAsync();
            await ExecutePublishAsync();

            var result = await PublishIdempotentAsync(command);

            result.ShouldBeEquivalent(sut.Snapshot);

            Assert.False(sut.Snapshot.SchemaDef.IsPublished);

            LastEvents
            .ShouldHaveSameEvents(
                CreateEvent(new SchemaUnpublished())
                );
        }
Example #9
0
 public void Unpublish(UnpublishSchema command)
 {
     RaiseEvent(SimpleMapper.Map(command, new SchemaUnpublished()));
 }
Example #10
0
 public static void CanUnpublish(UnpublishSchema command)
 {
     Guard.NotNull(command, nameof(command));
 }
Example #11
0
        public void CanUnpublish_should_throw_exception_if_already_unpublished()
        {
            var command = new UnpublishSchema();

            Assert.Throws <DomainException>(() => GuardSchema.CanUnpublish(schema_0, command));
        }
Example #12
0
 public void Unpublish(UnpublishSchema command)
 {
     RaiseEvent(command, new SchemaUnpublished());
 }
 protected Task On(UnpublishSchema command, CommandContext context)
 {
     return(handler.UpdateAsync <SchemaDomainObject>(context, s => s.Unpublish(command)));
 }
Example #14
0
 private void Unpublish(UnpublishSchema command)
 {
     Raise(command, new SchemaUnpublished());
 }