Ejemplo n.º 1
0
        public async Task PostTeacherTest()
        {
            //Arrange
            TeachersController teachersController = new TeachersController(_inMemoryDBContext);
            ActionResult <IEnumerable <Teacher> > _teacherList = await teachersController.GetTeachers();

            int startingCount = _teacherList.Value.Count <Teacher>();

            Teacher teacher = new Teacher();

            teacher.TeacherName = "Señora Maestra";

            //Act
            ActionResult <Teacher> newTeacher = await teachersController.PostTeacher(teacher);

            //Assert
            CreatedAtActionResult postResult = (CreatedAtActionResult)newTeacher.Result;
            Teacher createdTeacher           = (Teacher)postResult.Value;

            Assert.IsTrue(createdTeacher.TeacherKey > startingCount);
        }