public async Task ShouldUpdateDelivery()
        {
            var userId = await RunAsDefaultUserAsync();

            var listId = await SendAsync(new CreateZoneCommand { Title = "New Zone" });

            var itemId = await SendAsync(new CreateDeliveryCommand {
                ZoneId = listId,
                Title  = "New Delivery"
            });

            var command = new UpdateDeliveryDetailCommand {
                Id       = itemId,
                ZoneId   = listId,
                Note     = "This is the note.",
                Priority = PriorityLevel.High
            };

            await SendAsync(command);

            var item = await FindAsync <Delivery>(itemId);

            item.ZoneId.Should().Be(command.ZoneId);
            item.Note.Should().Be(command.Note);
            item.Priority.Should().Be(command.Priority);
            item.LastModifiedBy.Should().NotBeNull();
            item.LastModifiedBy.Should().Be(userId);
            item.LastModified.Should().NotBeNull();
            item.LastModified.Should().BeCloseTo(DateTime.Now, 10000);
        }
Beispiel #2
0
        public async Task <ActionResult> UpdateItemDetails(int id, UpdateDeliveryDetailCommand command)
        {
            if (id != command.Id)
            {
                return(BadRequest());
            }

            await Mediator.Send(command);

            return(NoContent());
        }