public async Task Handle_GivenNullRequest_ShouldThrowArgumentNullException() { // Arrange var sut = new CreateMatchQueryHandler(It.IsAny <IDeletableEntityRepository <PlayWeek> >(), It.IsAny <IMapper>()); // Act & Assert await Should.ThrowAsync <ArgumentNullException>(sut.Handle(null, It.IsAny <CancellationToken>())); }
public async Task Handle_GivenValidRequest_ShouldReturnViewModel() { // Arrange var query = new CreateMatchQuery { PlayWeekId = 1, TournamentTableId = 1 }; var playWeeksRepository = new EfDeletableEntityRepository <PlayWeek>(this.dbContext); var sut = new CreateMatchQueryHandler(playWeeksRepository, this.mapper); // Act var viewModel = await sut.Handle(query, It.IsAny <CancellationToken>()); // Assert viewModel.ShouldNotBeNull(); viewModel.Teams.Count().ShouldBe(3); }