Exemple #1
0
        public void GetAllTypeReqsTest()
        {
            var types = new List <TypeReqEntity>()
            {
                testTypeReqEntity
            };

            typeReqRepository.Setup(x => x.GetAll()).Returns(types);

            var result = typeReqLogic.GetAll();

            typeReqRepository.VerifyAll();
            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.Count());
            Assert.AreEqual(result.FirstOrDefault(), testTypeReqEntity);
        }
Exemple #2
0
        public ActionResult Get()
        {
            IEnumerable <TypeReqEntity> typeReqs;

            try
            {
                typeReqs = typeReqLogic.GetAll();
            }
            catch (ArgumentException ex)
            {
                return(BadRequest(ex.Message));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
            var typeReqsOut = mapper.Map <IEnumerable <TypeReqEntity>, IEnumerable <TypeReqModelOut> >(typeReqs);

            return(this.Ok(typeReqsOut));
        }