Exemplo n.º 1
0
        public async Task ShouldDeleteDistributor()
        {
            // Arrange

            // Create Distributor
            var createDistributorCommand = new CreateDistributorCommand
            {
                Name = "Test Distributor"
            };
            var distributorId = await SendAsync(createDistributorCommand);

            // Act

            // Delete Distributor
            var deleteDistributorCommand = new DeleteDistributorCommand
            {
                DistributorId = distributorId
            };

            await SendAsync(deleteDistributorCommand);

            var distributor = await FindAsync <Distributor, DistributorManagmentContext>(distributorId);

            // Assert
            distributor.Should().BeNull();
        }
Exemplo n.º 2
0
        public void ShouldRequireMinimumFields()
        {
            // Arrange
            var command = new DeleteDistributorCommand();

            // Act
            var results = FluentActions.Invoking(() => SendAsync(command));

            // Assert
            results.Should().Throw <BaseValidationException>();
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Delete([FromQuery] DeleteDistributorCommand command)
        {
            var result = await Mediator.Send(command);

            return(Ok(new { result }));
        }