public void ValidatorRelativityProcessFailsWhenNoCaseStatsBindingFound(BillingValidatorSettings billingSettings, [Frozen] IRelativityBillingRepo relBillingRepo, [Frozen] IRelativityProvidersRepo relProvidersRepo, IValidatorContext validatorContext) { var kernel = this.GetBillingValidatorWithAllKernelBindings(); var billingValidator = new BillingRanValidator(relBillingRepo, relProvidersRepo, billingSettings); IList <IValidatorResult> results = billingValidator.Execute(validatorContext); Assert.Equal(results.Where(r => r.ResultCode == ValidatorResultCode.Error).Count(), 4); }
public void ValidateRelativityProcessorCaseStatisticsRowsFoundSucceeds(IList <CaseStatisticsMonthly> caseStatsMonthlyList, IList <CaseStatistics> caseStatsList, List <ConfigSection> fakeSections, IList <DataCollectionsRuns> dataCollectionRunsList, IList <UserCollectionsRuns> userCollectionRunsList, BillingValidatorSettings billingSettings) { var kernel = this.GetBillingValidatorWithAllKernelBindings(); var relBillingRepo = kernel.Get <IRelativityBillingRepo>(); var relProvidersRepo = kernel.Get <IRelativityProvidersRepo>(); var billingValidator = new BillingRanValidator(relBillingRepo, relProvidersRepo, billingSettings); relBillingRepo.GetCaseStatistics(Arg.Any <DateTime>()).ReturnsForAnyArgs(caseStatsList); relBillingRepo.GetCaseStatisticsMonthly(Arg.Any <DateTime>()).ReturnsForAnyArgs(caseStatsMonthlyList); relProvidersRepo.GetDataCollectionsRuns(Arg.Any <DateTime>()).ReturnsForAnyArgs(dataCollectionRunsList); relProvidersRepo.GetUserCollectionsRuns(Arg.Any <DateTime>()).ReturnsForAnyArgs(userCollectionRunsList); var validatorContext = new ValidatorContext(); IList <IValidatorResult> results = billingValidator.Execute(validatorContext); Assert.Equal(results.Where(r => r.ResultCode == ValidatorResultCode.Success).Count(), 4); }
public void ValidateRelativityProviderUserCollectionRunsTestFailsCausesValidatorError(IList <CaseStatisticsMonthly> caseStatsMonthlyList, IList <CaseStatistics> caseStatsList, IValidatorContext validatorContext, IList <DataCollectionsRuns> dataCollectionRunsList, BillingValidatorSettings billingSettings) { var kernel = this.GetBillingValidatorWithAllKernelBindings(); var relBillingRepo = kernel.Get <IRelativityBillingRepo>(); var relProvidersRepo = kernel.Get <IRelativityProvidersRepo>(); var billingValidator = new BillingRanValidator(relBillingRepo, relProvidersRepo, billingSettings); relBillingRepo.GetCaseStatistics(Arg.Any <DateTime>()).ReturnsForAnyArgs(caseStatsList); relBillingRepo.GetCaseStatisticsMonthly(Arg.Any <DateTime>()).ReturnsForAnyArgs(caseStatsMonthlyList); relProvidersRepo.GetDataCollectionsRuns(Arg.Any <DateTime>()).ReturnsForAnyArgs(dataCollectionRunsList); relProvidersRepo.GetUserCollectionsRuns(Arg.Any <DateTime>()).ReturnsForAnyArgs(new List <UserCollectionsRuns>()); IList <IValidatorResult> results = billingValidator.Execute(validatorContext); Assert.Equal(results.Where(r => r.ResultCode == ValidatorResultCode.Error).Count(), 1); Assert.Equal(results.Where(r => r.ResultCode == ValidatorResultCode.Success).Count(), 3); }
public void ValidateRelativityProcessorFailsWhenCaseStatsThrowsException(IValidatorContext validatorContext, BillingValidatorSettings billingSettings) { var kernel = this.GetBillingValidatorWithAllKernelBindings(); var relBillingRepo = kernel.Get <IRelativityBillingRepo>(); var relProvidersRepo = kernel.Get <IRelativityProvidersRepo>(); relBillingRepo.GetCaseStatistics(Arg.Any <DateTime>()).ReturnsForAnyArgs(c => { throw new Exception("An exception occurred."); }); relBillingRepo.GetCaseStatisticsMonthly(Arg.Any <DateTime>()).ReturnsForAnyArgs(new List <CaseStatisticsMonthly>()); var billingValidator = new BillingRanValidator(relBillingRepo, relProvidersRepo, billingSettings); IList <IValidatorResult> results = billingValidator.Execute(validatorContext); Assert.Equal(results.Where(r => r.ResultCode == ValidatorResultCode.Error).Count(), 4); }