public async Task Handle_GivenNullRequest_ShouldThrowArgumentNullException() { // Arrange var sut = new GetMatchesForCurrentPlayWeeksQueryHandler(this.deletableEntityRepository, this.mapper); // Act await Should.ThrowAsync <ArgumentNullException>(sut.Handle(null, It.IsAny <CancellationToken>())); }
public async Task Handle_GivenValidRequest_ShouldReturnViewModel() { // Arrange var query = new GetMatchesForCurrentPlayWeeksQuery(); var sut = new GetMatchesForCurrentPlayWeeksQueryHandler(this.deletableEntityRepository, this.mapper); this.dbContext.Matches.AddRange(new[] { new Match { HomeTeamId = 1, AwayTeamId = 2, PlayWeekId = 3 }, new Match { HomeTeamId = 1, AwayTeamId = 2, PlayWeekId = 3 }, }); this.dbContext.SaveChanges(); // Act var viewModel = await sut.Handle(query, It.IsAny <CancellationToken>()); // Assert viewModel.ShouldNotBeNull(); viewModel.Matches.Count().ShouldBe(2); }