Пример #1
0
        public async Task Handle_GivenNullRequest_ShouldThrowArgumentNullException()
        {
            // Arrange
            var sut = new ModifyMatchQueryHandler(It.IsAny <IDeletableEntityRepository <Match> >(), It.IsAny <IMapper>());

            // Act & Assert
            await Should.ThrowAsync <ArgumentNullException>(sut.Handle(null, It.IsAny <CancellationToken>()));
        }
Пример #2
0
        public async Task Handle_GivenInvalidRequest_ShouldThrowNotFoundException()
        {
            // Arrange
            var query = new ModifyMatchQuery {
                MatchId = 12
            };
            var sut = new ModifyMatchQueryHandler(this.deletableEntityRepository, It.IsAny <IMapper>());

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

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

            // Assert
            command.ShouldNotBeNull();
            command.ShouldBeOfType <ModifyMatchCommand>();
            command.Id.ShouldBe(2);
            command.HomeTeamId.ShouldBe(1);
            command.AwayTeamId.ShouldBe(2);
        }