public TestMasterValidator(ITestMasterRepository testMasterRepository) { RuleFor(p => p.TestMasterName).NotEmpty().When(p => p.IsActive != false).WithMessage("Test Master Name is required field"); RuleFor(p => p.TestMasterName).Must(testMasterRepository.GetCountTestMasterByName).When(p => p.ModifiedBy != null && p.IsActive == true) .WithMessage("Provided Name already exists!! "); RuleFor(p => p.TestMasterName).Must(testMasterRepository.GetCountTestMasterByName).When(p => p.ModifiedBy == null && p.IsActive == true).WithMessage("Test Master Name already exists"); }
public TestMasterValidator(ITestMasterRepository testMasterRepository) { When(validateOperation, () => { RuleFor(x => x.TestMasterName).NotEmpty().WithMessage("test Name Can't be empty"); RuleFor(x => x.TestMasterName).Must((o, x) => { return(testMasterRepository.GetCountTestMasterByName(o.TestMasterName)); }).WithMessage("Test Name already exists"); }); }
public TestMasterValidator(ITestMasterRepository testMasterRepository) { // RuleFor(p => p.TestMasterName).NotEmpty().WithMessage("test master name can't be empty"); RuleFor(p => p.TestMasterName).NotEmpty().When(p => p.operation.ToLower() != "delete").WithMessage("test master name can't be empty");; //RuleFor(p => p.TestMasterName).NotEmpty().Must((o, x) => { return validateOpertaion(o.operation);}) //.WithMessage("test master name can't be empty"); RuleFor(p => p.TestMasterName).Must(testMasterRepository.GetCountTestMasterByName) .When(p => p.operation.ToLower() != "delete").WithMessage("Another TestMasterName with same name exists"); // RuleFor(p => p.Description).NotEmpty().WithMessage("Description can't be empty"); // RuleFor(d => d.operation).Must(validateOpertaion).DependentRules(x =>{ // x.RuleFor(p => p.TestMasterName).Must(testMasterRepository.GetCountTestMasterByName).WithMessage("Another TestMasterName with same name exists"); //}); }
/// <summary> /// dependency injected thru constructor /// </summary> /// <param name="testExpMasterRepo"></param> /// <param name="unitOfWork"></param> /// <param name="testMasRepo"></param> /// <param name="testRepo"></param> public TestExpressionService(ITestExpressionRepository testExpMasterRepo, IUnitOfWork unitOfWork, ITestMasterRepository testMasRepo , ITestRepository testRepo, IComponentRepositry componentRepo, IEquationRepositry equationRepo, ITestInputFieldsRepositry inputFieldRepo , IVWLocationAttributesRepository vWLocationAttributesRepo, IPartAttributesRepository partAttributesRepo , ITestCalculatedFieldsRepository testCalulatedFieldsRepo) { this.testExpressionRepository = testExpMasterRepo; this.unitOfWork = unitOfWork; this.testMasterRepository = testMasRepo; this.testRepository = testRepo; this.componentRepository = componentRepo; this.equationRepository = equationRepo; this.inputFieldRepository = inputFieldRepo; this.vWLocationAttributesRepository = vWLocationAttributesRepo; this.partAttributesRepository = partAttributesRepo; this.testCalulatedFieldsRepository = testCalulatedFieldsRepo; }
public TestMasterService(ITestMasterRepository testMasterRepository, IUnitOfWork unitOfWork, IMapper _iMapper) { this.testMasterRepository = testMasterRepository; this.unitOfWork = unitOfWork; this._iMapper = _iMapper; }
public TestMasterService(ITestMasterRepository testMasterRepository, IUnitOfWork unitOfWork, IValidatorFactory validatorFactory) { this.validatorFactory = validatorFactory; this.testMasterRepository = testMasterRepository; this.unitOfWork = unitOfWork; }