public GetBjdInfoService(IBaodanxinxiRepository baodanxinxiRepository, IBaodanXianZhongRepository baodanXianZhongRepository, IPreferentialActivityRepository preferentialActivityRepository, IBxBjUnionRepository bxBjUnionRepository, IUserClaimRepository userClaimRepository, ISaveQuoteRepository saveQuoteRepository, IMapBjdInfoRecord mapBjdInfoRecord, IGetBjdCheck getBjdCheck)
 {
     _preferentialActivityRepository = preferentialActivityRepository;
     _bxBjUnionRepository            = bxBjUnionRepository;
     _userClaimRepository            = userClaimRepository;
     _saveQuoteRepository            = saveQuoteRepository;
     _mapBjdInfoRecord = mapBjdInfoRecord;
     _getBjdCheck      = getBjdCheck;
     logErr            = LogManager.GetLogger("ERROR");
 }
예제 #2
0
        public void GetBjdInfo_ThrowExecption_ReturnNegavite()
        {
            #region 配置 Substitute

            IBaodanxinxiRepository          _baodanxinxiRepository          = Substitute.For <IBaodanxinxiRepository>();
            IBaodanXianZhongRepository      _baodanXianZhongRepository      = Substitute.For <IBaodanXianZhongRepository>();
            IPreferentialActivityRepository _preferentialActivityRepository = Substitute.For <IPreferentialActivityRepository>();
            IBxBjUnionRepository            _bxBjUnionRepository            = Substitute.For <IBxBjUnionRepository>();
            IUserClaimRepository            _userClaimRepository            = Substitute.For <IUserClaimRepository>();
            ISaveQuoteRepository            _saveQuoteRepository            = Substitute.For <ISaveQuoteRepository>();
            IMapBjdInfoRecord _mapBjdInfoRecord = Substitute.For <IMapBjdInfoRecord>();
            IGetBjdCheck      _getBjdCheck      = Substitute.For <IGetBjdCheck>();

            var bjdItemRequest = Arg.Any <GetBjdItemRequest>();

            _baodanxinxiRepository.When(x => x.Find(Arg.Any <int>())).Do(info =>
            {
                throw new Exception();
            });

            GetBjdInfoService getBjdInfoService = new GetBjdInfoService(_baodanxinxiRepository, _baodanXianZhongRepository, _preferentialActivityRepository,
                                                                        _bxBjUnionRepository, _userClaimRepository, _saveQuoteRepository, _mapBjdInfoRecord, _getBjdCheck);

            #endregion

            #region 操作 Arg

            var result = getBjdInfoService.GetBjdInfo(bjdItemRequest, null);

            #endregion

            #region 断言 Assert

            Assert.AreEqual(-1, result.BusinessStatus);

            #endregion
        }