public void IsValid_ShouldBeTrue()
        {
            var command = new DeletePhotosCommand
            {
                Ids = new List <int> {
                    1, 2, 3, 4, 5
                }
            };

            var validator = GetNewValidator();

            var result = validator.Validate(command);

            Assert.That(result.IsValid);
        }
예제 #2
0
        public async Task Handle_ShouldBeDeletePhotos()
        {
            var command = new DeletePhotosCommand
            {
                Ids = new List <int>()
            };

            command.Ids.AddRange(new[] { 1001, 1002, 1003 });
            command.Ids.AddRange(DefaultPhotoIds);

            var handler = GetNewHandler();

            var result = await handler.Handle(command, CancellationToken.None);

            Assert.That(result.Ids, IsNotNullOrEmpty);
            Assert.That(DefaultPhotoIds.All(id => result.Ids.Contains(id)));
        }
예제 #3
0
 public async Task <ActionResult <DeletePhotosResponseDto> > DeletePhotos(
     [FromBody] DeletePhotosCommand command)
 {
     return(await Mediator.Send(command));
 }