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

            var createDistributorCommand = new CreateDistributorCommand
            {
                Name = "Test Distributor"
            };

            var distributorId = await SendAsync(createDistributorCommand);


            // Act
            var updateDistributorCommand = new UpdateDistributorCommand
            {
                Id   = distributorId,
                Name = "Test Update Distributor"
            };

            await SendAsync(updateDistributorCommand);

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

            // Assert
            distributor.Should().NotBeNull();
            distributor.Name.Should().Be(updateDistributorCommand.Name);
        }
Example #2
0
        public void ShouldRequireMinimumFields()
        {
            // Arrange
            var command = new UpdateDistributorCommand();

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

            // Assert
            results.Should().Throw <BaseValidationException>();
        }
Example #3
0
        public async Task <IActionResult> Put([FromBody] UpdateDistributorCommand command)
        {
            var result = await Mediator.Send(command);

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