コード例 #1
0
        public async Task <SectionTypeDto> CreateSectionType(CreateSectionTypeDto pSectionType)
        {
            var lSectionTypeEntity = Mapping.Mapper.Map <SectionTypeEntity>(pSectionType);

            lSectionTypeEntity = await this._sectionTypeRepository.Add(lSectionTypeEntity);

            return(Mapping.Mapper.Map <SectionTypeDto>(lSectionTypeEntity));
        }
コード例 #2
0
        public async Task CreateSectionType()
        {
            this._sectionTypeRepository.Add(Arg.Any <SectionTypeEntity>()).Returns(info =>
            {
                var myEnt = info.Arg <SectionTypeEntity>();
                myEnt.Id  = 40;
                return(myEnt);
            });

            CreateSectionTypeDto lCreateSectionTypeDto = new CreateSectionTypeDto()
            {
                Name = "England"
            };

            var lNewlyCreatedSectionTypeDto = await this.referenceServices.CreateSectionType(lCreateSectionTypeDto);

            Assert.AreEqual("England", lNewlyCreatedSectionTypeDto.Name);
            Assert.AreEqual(40, lNewlyCreatedSectionTypeDto.Id);
        }