예제 #1
0
        public async Task GetLatestFiveMatchesForUser_ShouldBeDoneSuccessfully()
        {
            // Arrange
            var datePlayed    = DateTime.Now;
            var latestMatches = new List <LatestFiveMatchesView>()
            {
                new LatestFiveMatchesView()
                {
                    Id         = 1,
                    DatePlayed = datePlayed,
                    Goals      = 0,
                    HomeName   = "Test",
                    AwayName   = "Test",
                    Assists    = 1,
                    Place      = "Test",
                    Rating     = 10,
                    Result     = "1 - 0"
                }
            };

            _unitOfWorkMock.Setup(x => x.Matchdays.GetLatestFiveMatchesForUser(It.IsAny <int>()))
            .ReturnsAsync(latestMatches);

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

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

            Assert.NotNull(firstMatch);
            Assert.Equal(datePlayed, firstMatch.DatePlayed);
            Assert.Equal(1, firstMatch.Id);
            Assert.Equal(0, firstMatch.Goals);
            Assert.Equal("Test", firstMatch.HomeName);
            Assert.Equal("Test", firstMatch.AwayName);
            Assert.Equal(1, firstMatch.Assists);
            Assert.Equal(10, firstMatch.Rating);
            Assert.Equal("Test", firstMatch.Place);
            Assert.Equal("1 - 0", firstMatch.Result);
        }