Example #1
0
        public void GetAllAsync_ValidCall()
        {
            var lectures = LectureService.GetAllAsync().Result.ToList();

            Mock.Verify(m => m.GetAllAsync());

            for (var i = 1; i < GetAllTest().Result.Count(); ++i)
            {
                Assert.AreEqual(GetAllTest().Result.ToList()[i].Id, lectures[i].Id);
                Assert.AreEqual(GetAllTest().Result.ToList()[i].Name, lectures[i].Name);
                Assert.AreEqual(GetAllTest().Result.ToList()[i].ProfessorId, lectures[i].ProfessorId);
            }
        }
Example #2
0
        public void GetAllAsync_ThrowsValidationException()
        {
            Mock.Setup(repo => repo.GetAllAsync()).Returns(GetAllExceptionTest());

            Assert.ThrowsAsync <ValidationException>(async() => await LectureService.GetAllAsync());
        }