Ejemplo n.º 1
0
        public async Task Handle_GivenNullRequest_ShouldThrowArgumentNullException()
        {
            // Arrange
            var sut = new GetPlayerDetailsQueryHandler(It.IsAny <IDeletableEntityRepository <Player> >(), It.IsAny <IMapper>());

            // Act & Assert
            await Should.ThrowAsync <ArgumentNullException>(sut.Handle(null, It.IsAny <CancellationToken>()));
        }
Ejemplo n.º 2
0
        public async Task Handle_GivenInvalidRequest_ShouldThrowArgumentNullException()
        {
            // Arrange
            var query = new GetPlayerDetailsQuery {
                Username = "******"
            };
            var sut = new GetPlayerDetailsQueryHandler(this.deletableEntityRepository, this.mapper);

            // Act & Assert
            await Should.ThrowAsync <NotFoundException>(sut.Handle(query, It.IsAny <CancellationToken>()));
        }
Ejemplo n.º 3
0
        public async Task Handle_GivenValidRequest_ShouldReturnViewModel()
        {
            // Arrange
            var query = new GetPlayerDetailsQuery {
                Username = "******"
            };
            var sut = new GetPlayerDetailsQueryHandler(this.deletableEntityRepository, this.mapper);

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

            // Assert
            viewModel.ShouldNotBeNull();
            viewModel.Username.ShouldBe("FooP1");
            viewModel.Id.ShouldBe("Foo1");
        }