public void InsertTaTutorErrorTest() { //// Arrange var errors = new List<string>(); var mockRepository = new Mock<ITaTutorRepository>(); var tatutorService = new TaTutorService(mockRepository.Object); //// Act tatutorService.InsertTaTutor(null, ref errors); //// Assert Assert.AreEqual(1, errors.Count); }
public void InsertTaTutorBadId() { //// Arranage var errors = new List<string>(); var mockRepository = new Mock<ITaTutorRepository>(); var tatutorService = new TaTutorService(mockRepository.Object); var tatutor = new TaTutor { TaTutorId = "A012_3456", FirstName = "Jane", LastName = "Doe" }; //// Act tatutorService.InsertTaTutor(tatutor, ref errors); //// Assert Assert.AreEqual(1, errors.Count); }
public void GetTaTutorListTest() { //// Arrange var errors = new List<string>(); var mockRepository = new Mock<ITaTutorRepository>(); var tatutorService = new TaTutorService(mockRepository.Object); var tatutorList = new List<TaTutor>(); tatutorList.Add(new TaTutor { TaTutorId = "A0123456", FirstName = "Tony", LastName = "Stark" }); tatutorList.Add(new TaTutor { TaTutorId = "A0987655", FirstName = "John", LastName = "Smith" }); mockRepository.Setup(x => x.GetTutorList(ref errors)).Returns(tatutorList); //// Act var otherList = tatutorService.GetTutorList(ref errors); //// Assert Assert.AreEqual(tatutorList, otherList); }
public void UpdateTaTutorErrorTest2() { //// Arranage var errors = new List<string>(); var mockRepository = new Mock<ITaTutorRepository>(); var tatutorService = new TaTutorService(mockRepository.Object); var tatutor = new TaTutor { TaTutorId = string.Empty }; //// Act tatutorService.UpdateTaTutor(tatutor, ref errors); //// Assert Assert.AreEqual(1, errors.Count); }