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");
        }
示例#3
0
        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");
        }
示例#4
0
 public BeginTrainingBusinessValidator(MustExist mustExist)
 {
     RuleFor(_ => _.DataCollectorId)
     .Must(_ => mustExist(_)).WithMessage(_ => $"Data Collector with id {_.DataCollectorId.Value} is not registered");
 }
示例#5
0
 public ChangeLocationBusinessValidator(MustExist beAnActualDataCollector)
 {
     RuleFor(_ => _.DataCollectorId)
     .Must(_ => beAnActualDataCollector(_))
     .WithMessage(_ => $"Data Collector with id {_.DataCollectorId.Value} is not registered");
 }