public async Task TestGetRateCategoryById_positive_Predicate_sample()
        {
            //Arrange
            int rateCategoryId = 1;
            var rateCategory   = new RateCategory()
            {
                Id = 1, Name = "RateCategory1", IsActive = true, IsDeleted = false
            };
            var baseResult = new BaseResult <List <RateCategory> >()
            {
                Result = new List <RateCategory>()
                {
                    rateCategory
                }
            };
            var pred = new Func <RateCategory, bool>(x => x.Id == rateCategoryId && !x.IsDeleted);

            iRateCategoryLibrary.Setup(x => x.GetListByPredicate(It.Is <Func <RateCategory, bool> >(y => y.GetType() == pred.GetType()))).Returns(Task.FromResult(baseResult));
            //Act
            Task <BaseResult <List <RateCategory> > > result = rateCategoryRepository.GetRateCategoryById(rateCategoryId);

            //Assert
            Assert.IsTrue(result.Result != null);
            Assert.IsTrue(result.Result is BaseResult <List <RateCategory> >);
        }
        public async Task <IActionResult> GetRateCategoryById([FromBody] int rateCategoryId)
        {
            BaseResult <RateCategoryViewModel> rateCategoryViewModelResult = new BaseResult <RateCategoryViewModel>();
            BaseResult <List <RateCategory> >  rateCategoryResult          = new BaseResult <List <RateCategory> >();
            BaseResult <List <RatePlans> >     ratePlansResult             = new BaseResult <List <RatePlans> >();
            RateCategory rateCategoryRequest = new RateCategory();

            if (rateCategoryId <= default(int))
            {
                rateCategoryResult.IsError = true;
                rateCategoryResult.Message = string.Format(coreHelper.Constants.ErrorMessage.InvalidId, rateCategoryId);
                return(BadRequest(rateCategoryResult));
            }

            rateCategoryResult = await iRatesCategory.GetRateCategoryById(rateCategoryId).ConfigureAwait(false);

            if (rateCategoryResult.IsError && rateCategoryResult.ExceptionMessage != null)
            {
                return(new StatusCodeResult(500));
            }
            else if (rateCategoryResult.Result == null)
            {
                return(new NoContentResult()); //204
            }

            ratePlansResult = await iRatesCategory.GetRatePlansById(rateCategoryId).ConfigureAwait(false);

            if (ratePlansResult.IsError && ratePlansResult.ExceptionMessage != null)
            {
                return(new StatusCodeResult(500));
            }

            rateCategoryRequest = rateCategoryResult.Result.First();

            var result = RatesCategoryResponseMapper.MapToRateCategoryViewModel(rateCategoryRequest, ratePlansResult.Result);

            rateCategoryViewModelResult.Result = result;
            return(Ok(rateCategoryViewModelResult));
        }