public List<Instructor> GetInstructorList() { var errors = new List<string>(); var repository = new InstructorRepository(this.entities); var service = new InstructorService(repository); return service.GetInstructorList(ref errors); }
public void GetInstructorListTest() { //// Arrange var errors = new List<string>(); Mock<IInstructorRepository> mockRepository = new Mock<IInstructorRepository>(); InstructorService iserv = new InstructorService(mockRepository.Object); List<Instructor> crl = new List<Instructor>(); crl.Add(new Instructor { InstructorId = 99, FirstName = "T", LastName = "Test", Title = "Tester" }); mockRepository.Setup(x => x.GetInstructorList(ref errors)).Returns(crl); //// Act Instructor temp = iserv.GetInstructorList(ref errors)[0]; //// Assert Assert.AreEqual(0, errors.Count); Assert.AreEqual(99, temp.InstructorId); }