Esempio n. 1
0
        public async Task Handle_GivenNullRequest_ShouldThrowArgumentNullException()
        {
            // Arange
            var sut = new ModifyTournamentFormatCommandHandler(deletableEntityRepository);

            // Act & Assert
            await Should.ThrowAsync <ArgumentNullException>(sut.Handle(null, It.IsAny <CancellationToken>()));
        }
Esempio n. 2
0
        public async Task Handle_GivenValidRequest_ShouldModifyEntity()
        {
            // Arrange
            var sut = new ModifyTournamentFormatCommandHandler(deletableEntityRepository);

            var tournamentFormatId = 2;
            var command            = new ModifyTournamentFormatCommand
            {
                Id          = tournamentFormatId,
                Name        = "9v9",
                Description = "Changed description from test",
            };

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

            // Assert
            var desiredEntity = this.deletableEntityRepository.AllAsNoTracking().SingleOrDefault(x => x.Id == tournamentFormatId);

            id.ShouldBe(tournamentFormatId);
            desiredEntity.Name.ShouldBe("9v9");
            desiredEntity.Description.ShouldBe("Changed description from test");
        }