Exemplo n.º 1
0
        public void GetAdditionalFieldsFromTypeTest()
        {
            testTypeReqEntity.AdditionalFields.Add(testAFEntity);
            typeReqRepository.Setup(w => w.Exists(It.IsAny <Expression <Func <TypeReqEntity, bool> > >())).Returns(true);
            aFRepository.Setup(w => w.GetAll()).Returns(testTypeReqEntity.AdditionalFields);
            typeReqRepository.Setup(r => r.FirstOrDefault(It.IsAny <Expression <Func <TypeReqEntity, bool> > >())).Returns(testTypeReqEntity);

            var result = typeReqLogic.GetAdditionalFields(testTypeReqEntity.Id);

            typeReqRepository.VerifyAll();
            Assert.IsNotNull(result);
        }
Exemplo n.º 2
0
        public ActionResult GetAdditionalFields(int id)
        {
            IEnumerable <AdditionalFieldEntity> addFs;

            try
            {
                addFs = typeReqLogic.GetAdditionalFields(id);
            }
            catch (ArgumentException ex)
            {
                return(BadRequest(ex.Message));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
            var addFsOut = mapper.Map <IEnumerable <AdditionalFieldEntity>, IEnumerable <AdditionalFieldModelOut> >(addFs);

            return(this.Ok(addFsOut));
        }