public async Task TestGetRatePlansById_positive_Predicate_sample()
        {
            //Arrange
            int ratePlanId = 1, rateCategoryId = 1;
            var ratePlan = new RatePlans()
            {
                Id = 1, RateCategoryId = 1, IsActive = true, IsDeleted = false
            };
            var baseResult = new BaseResult <List <RatePlans> >()
            {
                Result = new List <RatePlans>()
                {
                    ratePlan
                }
            };
            var pred = new Func <RatePlans, bool>(x => x.RateCategoryId == rateCategoryId);

            iRatePlansLibrary.Setup(x => x.GetListByPredicate(It.Is <Func <RatePlans, bool> >(y => y.GetType() == pred.GetType()))).Returns(Task.FromResult(baseResult));
            //Act
            Task <BaseResult <List <RatePlans> > > result = rateCategoryRepository.GetRatePlansById(ratePlanId);

            //Assert
            Assert.IsTrue(result.Result != null);
            Assert.IsTrue(result.Result is BaseResult <List <RatePlans> >);
        }
        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));
        }