public void CheckRequest_NewRateNotNull_ReturnsFalse()
        {
            _validateService.ValidateAgent(Arg.Any <GetMyBjdDetailRequest>()).Returns(x => new BaseResponse()
            {
                Status = HttpStatusCode.OK
            });
            var result = _checkRequestService.CheckRequest(new bx_userinfo()
            {
                Id = 100, IsSingleSubmit = 1
            }, new GetMyBjdDetailRequest()
            {
                NewRate = "0.2"
            });

            Assert.AreEqual(0, result.BusinessStatus);
        }
Exemple #2
0
        public MyBaoJiaViewModel CheckRequest(bx_userinfo userInfo, GetMyBjdDetailRequest request)
        {
            var my = new MyBaoJiaViewModel();

            if (userInfo == null || userInfo.Id == 0)
            {
                my.BusinessStatus = -10000;
                my.StatusMessage  = "无法获取数据";
                return(my);
            }
            if (request.NewRate != null && !SourceGroupAlgorithm.ParseSource((int)userInfo.IsSingleSubmit).Contains(8))
            {
                my.BusinessStatus = 0;
                my.StatusMessage  = "没有找到国寿财报价信息";
                return(my);
            }
            BaseResponse baseResponse = _validateService.ValidateAgent(request, userInfo);

            if (baseResponse.Status == HttpStatusCode.Forbidden)
            {
                my.BusinessStatus = -10000;
                my.StatusMessage  = "请求数据无权限";
            }
            else
            {
                my.BusinessStatus = 1;
            }

            return(my);
        }
        public void CheckRequest_UserInfoIsNull_ReturnsFalse()
        {
            IValidateService _validateService = Substitute.For <IValidateService>();

            _validateService.ValidateAgent(Arg.Any <GetMyBjdDetailRequest>()).Returns(x => new BaseResponse()
            {
                Status = HttpStatusCode.OK
            });
            var result = _checkRequestService.CheckRequest(null, new GetMyBjdDetailRequest()
            {
            });

            Assert.AreEqual(-10000, result.BusinessStatus);
        }