public void Test_GetMatchByMatchId_Fail_BadRequest() { var matchesServices = new MatchesServices(_matchesRepository.Object, _userServices.Object); Assert.ThrowsAsync <ArgumentException>(() => matchesServices.GetMatchByMatchId(0, "token")); _matchesRepository.Verify(u => u.GetMatchByMatchId(It.IsAny <long>()), Times.Never); }
public void Test_GetMatchByMatchId_Fail_InvalidId() { _matchesRepository.Setup(u => u.GetMatchByMatchId(It.IsAny <long>())); var matchesServices = new MatchesServices(_matchesRepository.Object, _userServices.Object); Assert.ThrowsAsync <Exception>(() => matchesServices.GetMatchByMatchId(1, "token")); _matchesRepository.Verify(u => u.GetMatchByMatchId(It.IsAny <long>()), Times.Once); }
public async Task Test_GetMatchByMatchId_Success() { _matchesRepository.Setup(u => u.GetMatchByMatchId(It.IsAny <long>())) .ReturnsAsync(new Matches() { Id = 1, FirstUserId = 1, SecondUserId = 2, Liked = true, Matched = false }); var matchesServices = new MatchesServices(_matchesRepository.Object, _userServices.Object); await matchesServices.GetMatchByMatchId(1, "token"); _matchesRepository.Verify(u => u.GetMatchByMatchId(It.IsAny <long>()), Times.Once); }