Exemplo n.º 1
0
        public async Task GetUpcomingMatchesApplicableForUser_ShouldBeDoneSuccessfully()
        {
            // Arrange
            var matchdayId  = 1;
            var datePlaying = DateTime.Now;
            var matchdays   = new List <Matchday>()
            {
                new Matchday()
                {
                    Id          = matchdayId,
                    DatePlaying = datePlaying
                }
            };

            var matchdaysToReturnDto = new List <MatchdayToReturnDto>()
            {
                new MatchdayToReturnDto()
                {
                    Id          = matchdayId,
                    DatePlaying = datePlaying
                }
            };

            _unitOfWorkMock.Setup(x => x.Matchdays.GetUpcomingMatchesApplicableForUser(It.IsAny <int>()))
            .ReturnsAsync(matchdays);

            _mapperMock.Setup(x => x.Map <ICollection <MatchdayToReturnDto> >(matchdays))
            .Returns(matchdaysToReturnDto);

            // Act
            var result = await _sut.GetUpcomingMatchesApplicableForUser(It.IsAny <int>());

            // Assert
            var firstMatch = result.FirstOrDefault();

            Assert.Equal(matchdayId, firstMatch.Id);
            Assert.Equal(datePlaying, firstMatch.DatePlaying);
        }