Пример #1
0
        public async Task Handle_GivenInvalidRequest_ShouldThrowNotFoundException()
        {
            // Arrange
            var query = new ModifyTournamentQuery {
                Id = 123
            };
            var sut = new ModifyTournamentQueryHandler(this.deletableEntityRepository, this.mapper);

            // Act & Assert
            await Should.ThrowAsync <NotFoundException>(sut.Handle(query, It.IsAny <CancellationToken>()));
        }
Пример #2
0
        public async Task Handle_GivenValidRequest_ShouldReturnModifyTournamentCommand()
        {
            // Arrange
            var query = new ModifyTournamentQuery {
                Id = 1
            };
            var sut = new ModifyTournamentQueryHandler(this.deletableEntityRepository, this.mapper);

            // Act
            var command = await sut.Handle(query, It.IsAny <CancellationToken>());

            // Assert
            command.ShouldNotBeNull();
            command.Name.ShouldBe("TestTournament1");
        }
Пример #3
0
        public async Task <IActionResult> Modify(ModifyTournamentQuery query)
        {
            var viewModel = await this.Mediator.Send(query);

            return(this.View(viewModel));
        }
Пример #4
0
 public async Task <IActionResult> Modify(ModifyTournamentQuery query)
 => this.View(await this.Mediator.Send(query));