public void DeleteInstructorTest()
        {
            //// Arrange
            var errors = new List<string>();
            var mockRepository = new Mock<IInstructorRepository>();
            var instructorService = new InstructorService(mockRepository.Object);

            //// Act
            instructorService.DeleteInstructor(null, ref errors);

            //// Assert
            Assert.AreEqual(1, errors.Count);
        }
        public string DeleteInstructor(string id)
        {
            var errors = new List<string>();
            var repository = new InstructorRepository();
            var service = new InstructorService(repository);
            service.DeleteInstructor(id, ref errors);

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

            return "error";
        }
Example #3
0
        public void DeleteInstructor()
        {
            //// Arranage
            var errors = new List<string>();
            var mockRepository = new Mock<IInstructorRepository>();
            var instructorService = new InstructorService(mockRepository.Object);
            var instructor = new Instructor { InstructorId = 2, FirstName = "bb", LastName = "cc", Title = "nope" };

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

            //// Act
            instructorService.DeleteInstructor(2, ref errors);

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