public async Task ShouldThrownAnExceptionIfLeagueIsAlreadyImported() { //ARRANGE const string leaguecode = "Already Imported League code"; _leagueCodeRepository.Setup(l => l.CheckIfLeagueExists(leaguecode)).Returns(Task.FromResult(true)); _leagueRepository.Setup(l => l.CheckIfLeagueIsAlreadyImported(leaguecode)).Returns(Task.FromResult(true)); var sut = new LeagueService(_leagueCodeRepository.Object, _leagueRepository.Object, _playersRepository.Object, _importService.Object); //ACT await sut.ImportLeague(leaguecode); //ASSERT }
public async Task ShouldInvokeLeagueServiceWithAValidLeagueCode() { //ARRANGE const string leaguecode = "Dummy league code"; _leagueCodeRepository.Setup(l => l.CheckIfLeagueExists(leaguecode)).Returns(Task.FromResult(true)); _leagueRepository.Setup(l => l.CheckIfLeagueIsAlreadyImported(leaguecode)).Returns(Task.FromResult(false)); var sut = new LeagueService(_leagueCodeRepository.Object, _leagueRepository.Object, _playersRepository.Object, _importService.Object); //ACT await sut.ImportLeague(leaguecode); //ASSERT _importService.Verify(i => i.Import(leaguecode), Times.Once); }