예제 #1
0
        public void Delete_ExistingTeacher_OkResult()
        {
            var controller = new TeacherController(_logger, _teacherService);
            var teacher    = new Entities.Models.Teacher
            {
                Id             = new Guid("f7afefa9-2cc6-4ea9-901d-d99e227a12de"),
                FirstName      = "Bart",
                LastName       = "Simpson",
                DocumentType   = Entities.Models.EDocumentType.CC,
                DocumentNumber = "97654315",
                Address        = "Springfield 123",
                Email          = "*****@*****.**",
                City           = "Springfield",
                PhoneNumber    = "7654321",
                Birth          = new DateTime(1950, 11, 1)
            };

            var data = controller.CreateTeacher(teacher);

            Assert.IsType <CreatedAtRouteResult>(data as CreatedAtRouteResult);

            var deleteResult = controller.DeleteTeacher(teacher.Id);

            Assert.IsType <NoContentResult>(deleteResult);
        }
예제 #2
0
        public void Create_TeacherWithValidData_OkResult()
        {
            var controller = new TeacherController(_logger, _teacherService);
            var teacher    = new Entities.Models.Teacher
            {
                Id             = new Guid("a6a79ee2-3e9d-4abd-86ce-6acb1958e76a"),
                FirstName      = "Homero",
                LastName       = "Simpson",
                DocumentType   = Entities.Models.EDocumentType.CC,
                DocumentNumber = "1245687",
                Address        = "Springfield 123",
                Email          = "*****@*****.**",
                City           = "Springfield",
                PhoneNumber    = "7654321",
                Birth          = new DateTime(1950, 11, 1)
            };

            var data = controller.CreateTeacher(teacher);

            Assert.IsType <CreatedAtRouteResult>(data as CreatedAtRouteResult);
        }