public async Task UpdateAsync_WhenCalled_UpdateExistingMatch() { var match = new Match { Id = 1 }; await _matchService.UpdateAsync(match); _unitOfWork.Verify(u => u.CompleteAsync(), Times.Once); }
public async Task DeleteAsync_WhenCalled_DeleteMatchFromDb() { var match = new Match { Id = 1 }; await _matchService.DeleteAsync(match); _matchRepository.Verify(m => m.Remove(match), Times.Once); _unitOfWork.Verify(u => u.CompleteAsync(), Times.Once); }
public async Task CreateAsync_WhenCalled_CreateNewMatch() { var match = new Match { Id = 1 }; await _matchService.CreateAsync(match); _matchRepository.Verify(m => m.Add(match), Times.Once); _unitOfWork.Verify(u => u.CompleteAsync(), Times.Once); }
public async Task GetByIdAsync_WhenCalled_GetMatchFromDb() { const int id = 1; var expectedMatch = new Match { Id = id }; _matchRepository.Setup(m => m.GetAsync(id)).ReturnsAsync(expectedMatch); var result = await _matchService.GetByIdAsync(id); Assert.That(result, Is.Not.Null); Assert.That(result, Is.EqualTo(expectedMatch)); }