public RemovePhoneNumberFromDataCollectorBusinessValidator(MustExist beAnActualDataCollector, PhoneNumberShouldBeRegistered beARegisteredNumber) { RuleFor(_ => _.DataCollectorId) .Must(_ => beAnActualDataCollector(_)) .WithMessage(_ => $"Data Collector with id {_.DataCollectorId.Value} is not registered"); RuleFor(_ => _.PhoneNumber) .Must(_ => beARegisteredNumber(_)).WithMessage(number => $"Phone number {number} is not registered"); }
public AddPhoneNumberToDataCollectorBusinessValidator(MustExist beAnActualDataCollector, PhoneNumberShouldNotBeRegistered notBeARegisteredNumber) { RuleFor(_ => _.DataCollectorId) .Must(_ => beAnActualDataCollector(_)) .WithMessage(_ => $"Data Collector with id {_.DataCollectorId.Value} is not registered"); RuleFor(_ => _.PhoneNumber) .Must(_ => notBeARegisteredNumber(_)).WithMessage(number => $"Phone number {number} is already registered"); }
public ChangeBaseInformationBusinessValidator( MustExist beAnActualDataCollector, MustBeAllowedToChangeDisplayName beAllowedToChangeDisplayName) { RuleFor(_ => _.DataCollectorId) .Must(_ => beAnActualDataCollector(_)) .WithMessage(_ => $"Data Collector with id {_.DataCollectorId.Value} is not registered"); ModelRule() .Must(_ => beAllowedToChangeDisplayName(_.DataCollectorId, _.DisplayName)) .WithMessage(_ => $"Datacollector display name {_.DisplayName} is already taken, choose another"); }
public BeginTrainingBusinessValidator(MustExist mustExist) { RuleFor(_ => _.DataCollectorId) .Must(_ => mustExist(_)).WithMessage(_ => $"Data Collector with id {_.DataCollectorId.Value} is not registered"); }
public ChangeLocationBusinessValidator(MustExist beAnActualDataCollector) { RuleFor(_ => _.DataCollectorId) .Must(_ => beAnActualDataCollector(_)) .WithMessage(_ => $"Data Collector with id {_.DataCollectorId.Value} is not registered"); }