public async Task SholdThrowError_IfMatchListItemIsInvalid() { //Arrange IMatchListItemsService matchListItemService = new MatchListItemsService(); MatchListItem matchListItem = new MatchListItem(); var handler = new AddMatchListItemCommandHandler(matchListItemService); //Assert Assert.ThrowsAsync <ValidationException>(async() => { await handler.Handle(new AddMatchListItemCommand { MatchListItem = matchListItem }, CancellationToken.None); }); }
public async Task ShouldAddMatchListItem() { //Arrange IMatchListItemsService matchListItemService = new MatchListItemsService(); MatchListItem matchListItem = new MatchListItem(); var handler = new AddMatchListItemCommandHandler(matchListItemService); //Act await handler.Handle(new AddMatchListItemCommand { MatchListItem = matchListItem }, CancellationToken.None); //Assert MatchListItem result = matchListItemService.GetMatchById(matchListItem.Id); result.Should().NotBeNull(); result.Should().Be(matchListItem); }
public async Task ShouldAddMatchListItem() { //Arrange IMatchListItemsService matchListItemService = new MatchListItemsService(); MatchListItem matchListItem = new MatchListItem { Id = Guid.NewGuid().ToString(), Url = Guid.NewGuid().ToString(), Name = "Game", Password = "******", }; var handler = new AddMatchListItemCommandHandler(matchListItemService); //Act await handler.Handle(new AddMatchListItemCommand { MatchListItem = matchListItem }, CancellationToken.None); //Assert MatchListItem result = matchListItemService.GetMatchById(matchListItem.Id); result.Should().NotBeNull(); result.Should().Be(matchListItem); }