Esempio n. 1
0
        public void DeleteTaErrorTest()
        {
            //// Arrange
            var errors = new List<string>();

            var mockRepository = new Mock<ITaRepository>();
            var teachingAssistantService = new TaService(mockRepository.Object);

            //// Act
            teachingAssistantService.DeleteTa(0, ref errors);

            //// Assert instructor id cannot be null
            Assert.AreEqual(1, errors.Count);
        }
Esempio n. 2
0
        public string DeleteTa(int id)
        {
            var errors = new List<string>();
            var repository = new TaRepository(this.entities);
            var service = new TaService(repository);
            service.DeleteTa(id, ref errors);

            if (errors.Count == 0)
            {
                return "ok";
            }

            return "error";
        }
Esempio n. 3
0
        public void DeleteTa()
        {
            //// Arranage
            var errors = new List<string>();
            var mockRepository = new Mock<ITaRepository>();
            var ta_Service = new TaService(mockRepository.Object);

            mockRepository.Setup(x => x.RemoveTa(2, ref errors));

            //// Act
            ta_Service.DeleteTa(2, ref errors);

            //// Assert
            mockRepository.Verify(x => x.RemoveTa(2, ref errors), Times.Once());
        }