public async Task ReturnNullWhenMatchDoNotExistsInDbByGivenId() { // Arrange _matchRepository = SoccerStatisticsContextMocker.GetInMemoryMatchRepository("GetMatchByIdReturnNull"); Match testMatch = null; // Act var err = await Record.ExceptionAsync(async () => testMatch = await _matchRepository.GetByIdAsync(0)); // Assert err.Should().BeNull(); testMatch.Should().BeNull(); }
public async void ReturnMatchWhichExistsInDbByGivenId() { // Arrange _matchRepository = SoccerStatisticsContextMocker.GetInMemoryMatchRepository("GetMatchByIdReturnMatch"); var expectedMatch = new Match { Id = 1, AmountOfFans = 60_123, Date = new DateTime(2015, 3, 4), }; Match testMatch = null; //Act var err = await Record.ExceptionAsync(async() => testMatch = await _matchRepository.GetByIdAsync(1)); // Assert err.Should().BeNull(); testMatch.Should().NotBeNull(); testMatch.Should().BeEquivalentTo(expectedMatch); }