public void PreviousMustNotBeInUse()
 {
     RuleFor(x => x)
     .Must(x =>
     {
         var chains     = _reviewsDatastore.ByEvidence(x.EvidenceId);
         var allPrevIds = chains.SelectMany(chain => chain.Select(review => review.PreviousId));
         return(!allPrevIds.Contains(x.PreviousId));
     })
     .When(x => !string.IsNullOrEmpty(x.PreviousId))
     .WithMessage("Previous review already in use");
 }
Пример #2
0
 public IEnumerable <IEnumerable <T> > ByEvidence(string evidenceId)
 {
     return(_filter.Filter(_datastore.ByEvidence(evidenceId)));
 }