Esempio n. 1
0
 public Ta GetTa(int id)
 {
     var errors = new List<string>();
     var repository = new TaRepository(this.entities);
     var service = new TaService(repository);
     return service.GetTaById(id, ref errors);
 }
Esempio n. 2
0
        public void GetTa()
        {
            var errors = new List<string>();
            var mockRepository = new Mock<ITaRepository>();
            var teachingAssistantService = new TaService(mockRepository.Object);
            var ta_1 = new Ta { FirstName = "hi", LastName = "bye", TaId = 5 };
            var returnTa = new Ta();

            mockRepository.Setup(x => x.FindTaById(5, ref errors)).Returns(ta_1);
            returnTa = teachingAssistantService.GetTaById(5, ref errors);

            Assert.AreEqual(returnTa.TaId, 5);
            Assert.AreEqual(returnTa.FirstName, "hi");
            Assert.AreEqual(returnTa.LastName, "bye");
        }