コード例 #1
0
        public void CreateSchool()
        {
            // Arrange
            var schoolDto = new SchoolDto
            {
                Name = "New School 1"
            };
            var school = _mapper.Map <School>(schoolDto);

            Mock.Get(_repositoryWrapper.School).Setup(x => x.CreateSchool(school));
            Mock.Get(_repositoryWrapper.School).Setup(x => x.GetSchoolById(school.Id)).ReturnsAsync(school);
            var controller = new SchoolController(_loggerManager, _mapper, _repositoryWrapper);
            // Act
            var actionResult = controller.CreateSchool(schoolDto).Result;
            // Assert
            var okObjectResult = actionResult as OkObjectResult;

            Assert.IsNotNull(okObjectResult);
        }