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