Example #1
0
        public async Task Should_create_owner()
        {
            //Arrange

            //Act
            var createdId = await EntitySetupHelper.CreateOwner().ConfigureAwait(false);

            var created = await FindAsync <Owner>(createdId);

            //Assert
            createdId.ShouldBeGreaterThan(0);
            created.ShouldNotBeNull();
        }
        public async Task Should_read_block()
        {
            //Arrange
            var createdId = await EntitySetupHelper.CreateOwner().ConfigureAwait(false);

            var query = new Details.Query {
                Id = createdId
            };

            //Act
            var entity = await SendAsync(query).ConfigureAwait(false);

            //Assert
            entity.ShouldNotBeNull();
            entity.Id.ShouldBe(createdId);
        }
        public async Task Should_soft_delete_owner()
        {
            //Arrange
            var createdId = await EntitySetupHelper.CreateOwner().ConfigureAwait(false);

            var command = new Delete.Command {
                Id = createdId
            };

            //Act
            await SendAsync(command).ConfigureAwait(false);

            var deleted = await ExecuteDbContextAsync <Owner>(x => x.Owners.FirstActiveAsync(y => y.Id == createdId)).ConfigureAwait(false);

            //Assert
            deleted.ShouldBeNull();
        }
        public async Task Should_edit_owner()
        {
            //Arrange
            var createdId = await EntitySetupHelper.CreateOwner().ConfigureAwait(false);

            var command = new Edit.Command
            {
                Id   = createdId,
                Name = "Foo"
            };

            //Act
            await SendAsync(command).ConfigureAwait(false);

            var edited = await FindAsync <Owner>(createdId);

            //Assert
            edited.ShouldNotBeNull();
            edited.Name.ShouldBe("Foo");
        }