Exemple #1
0
        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();
        }
Exemple #2
0
        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);
        }