public void GetAsync_ThrowsValidationException() { Mock.Setup(repo => repo.GetAsync(It.IsAny <int>())) .Returns(GetExceptionTest()); Assert.ThrowsAsync <ValidationException>(async() => await ProfessorService.GetAsync(null)); Assert.ThrowsAsync <ValidationException>(async() => await ProfessorService.GetAsync(It.IsAny <int>())); }
public void GetAsync_ValidCall() { const int id = 1; var professor = ProfessorService.GetAsync(id).Result; Mock.Verify(m => m.GetAsync(id)); Assert.AreEqual(GetTest().Result.Id, professor.Id); Assert.AreEqual(GetTest().Result.FirstName, professor.FirstName); Assert.AreEqual(GetTest().Result.LastName, professor.LastName); }