Exemplo n.º 1
0
        public async Task GetUserStatusForMatchday_ShouldBeDoneSuccessfully()
        {
            // Arrange
            var datePlaying = DateTime.Now;
            var matchdayId  = 1;
            var userId      = 1;
            var matchday    = new Matchday()
            {
                Id          = matchdayId,
                DatePlaying = datePlaying
            };

            var matchstatus = new MatchStatus()
            {
                UserId     = userId,
                MatchdayId = matchdayId
            };

            var matchStatusToReturnDto = new MatchStatusToReturnDto()
            {
                Checked = true
            };

            _unitOfWorkMock.Setup(x => x.Matchdays.GetById(It.IsAny <int>()))
            .ReturnsAsync(matchday);

            _unitOfWorkMock.Setup(x => x.MatchStatuses.GetMatchStatusById(It.IsAny <int>(), It.IsAny <int>()))
            .ReturnsAsync(matchstatus);

            _mapperMock.Setup(x => x.Map <MatchStatusToReturnDto>(matchstatus))
            .Returns(matchStatusToReturnDto);

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

            // Assert
            Assert.True(result.Checked);
        }