public void AutoGeneratesDifferential() { var identifierBsn = _source.FindStructureDefinition("http://validationtest.org/fhir/StructureDefinition/IdentifierWithBSN"); Assert.NotNull(identifierBsn); identifierBsn.Snapshot = null; var instance = new Identifier("http://clearly.incorrect.nl/definition", "1234"); var validationContext = new ValidationSettings { ResourceResolver = _source, GenerateSnapshot = false }; var automatedValidator = new Validator(validationContext); var report = automatedValidator.Validate(instance, identifierBsn); Assert.True(report.ToString().Contains("does not include a snapshot")); validationContext.GenerateSnapshot = true; report = automatedValidator.Validate(instance, identifierBsn); Assert.False(report.ToString().Contains("does not include a snapshot")); bool snapshotNeedCalled = false; // I disabled cloning of SDs in the validator, so the last call to Validate() will have added a snapshot // to our local identifierBSN identifierBsn.Snapshot = null; automatedValidator.OnSnapshotNeeded += (object s, OnSnapshotNeededEventArgs a) => { snapshotNeedCalled = true; /* change nothing, warning should return */ }; report = automatedValidator.Validate(instance, identifierBsn); Assert.True(snapshotNeedCalled); Assert.True(report.ToString().Contains("does not include a snapshot")); }
public static ProcessActivityTreeOptions GetValidationOptions(ValidationSettings settings) { ProcessActivityTreeOptions result = null; if (settings.SkipValidatingRootConfiguration && settings.SingleLevel) { result = ProcessActivityTreeOptions.SingleLevelSkipRootConfigurationValidationOptions; } else if (settings.SkipValidatingRootConfiguration) { result = ProcessActivityTreeOptions.SkipRootConfigurationValidationOptions; } else if (settings.SingleLevel) { result = ProcessActivityTreeOptions.SingleLevelValidationOptions; } else if (settings.PrepareForRuntime) { Fx.Assert(!settings.SkipValidatingRootConfiguration && !settings.SingleLevel && !settings.OnlyUseAdditionalConstraints, "PrepareForRuntime cannot be set at the same time any of the three is set."); result = ProcessActivityTreeOptions.ValidationAndPrepareForRuntimeOptions; } else { result = ProcessActivityTreeOptions.ValidationOptions; } if (settings.CancellationToken == CancellationToken.None) { return(result); } else { return(AttachCancellationToken(result, settings.CancellationToken)); } }
public ValidationSettings Build() { blockSettings = new ValidationSettings(); if (!blockSettingsNode.RequirePermission) // don't set if false { blockSettings.SectionInformation.RequirePermission = blockSettingsNode.RequirePermission; } foreach (TypeNode typeNode in blockSettingsNode.Hierarchy.FindNodesByType(typeof(TypeNode))) { ValidatedTypeReference typeReference = new ValidatedTypeReference(); typeReference.Name = typeNode.TypeName; typeReference.AssemblyName = typeNode.AssemblyName; if (typeNode.DefaultRule != null) { typeReference.DefaultRuleset = typeNode.DefaultRule.Name; } BuildRules(typeReference, typeNode); blockSettings.Types.Add(typeReference); } return(blockSettings); }
public static void Validate_DeliveryDateAfterMaxDeliveryDateOffsetInDays_SuccessIsFalse( Order order, CreateOrderItemModel model, CatalogueItemType itemType, ValidationSettings validationSettings) { model.ServiceRecipients.Should().NotBeNullOrEmpty(); OrderItemValidator orderItemValidator = new OrderItemValidator(validationSettings); var serviceRecipients = model.ServiceRecipients.Select(_ => new OrderItemRecipientModel { DeliveryDate = order.CommencementDate.Value.AddDays(validationSettings.MaxDeliveryDateOffsetInDays + 1) }).ToList(); var result = orderItemValidator.Validate(order, new CreateOrderItemModel { ServiceRecipients = serviceRecipients }, itemType); result.FailedValidations.Should().NotBeEmpty(); foreach ((_, ValidationResult validationResult) in result.FailedValidations) { var errorDetails = validationResult.Errors.SingleOrDefault(); errorDetails.Should().NotBeNull(); errorDetails.Field.Should().Be("DeliveryDate"); errorDetails.Id.Should().Be("DeliveryDateOutsideDeliveryWindow"); } result.Success.Should().BeFalse(); }
public static void Validate_DeliveryDateWithinMaxDeliveryDateOffsetInDays_SuccessIsTrue( Order order, CreateOrderItemModel model, CatalogueItemType itemType, ValidationSettings validationSettings) { model.ServiceRecipients.Should().NotBeNullOrEmpty(); itemType.Should().NotBe(CatalogueItemType.AssociatedService); var serviceRecipients = model.ServiceRecipients.Select(_ => new OrderItemRecipientModel { DeliveryDate = order.CommencementDate.Value.AddDays(validationSettings.MaxDeliveryDateOffsetInDays - 1) }).ToList(); OrderItemValidator orderItemValidator = new OrderItemValidator(validationSettings); order.CommencementDate.Should().NotBeNull(); var result = orderItemValidator.Validate(order, new CreateOrderItemModel { ServiceRecipients = serviceRecipients }, itemType); result.FailedValidations.Should().BeEmpty(); result.Success.Should().BeTrue(); }
public void CanBuildValidationInstanceFactoryFromGivenConfiguration() { DictionaryConfigurationSource configurationSource = new DictionaryConfigurationSource(); ValidationSettings settings = new ValidationSettings(); configurationSource.Add(ValidationSettings.SectionName, settings); ValidatedTypeReference typeReference = new ValidatedTypeReference(typeof(BaseTestDomainObject)); settings.Types.Add(typeReference); typeReference.DefaultRuleset = "RuleA"; ValidationRulesetData ruleData = new ValidationRulesetData("RuleA"); typeReference.Rulesets.Add(ruleData); ValidatedPropertyReference propertyReference1 = new ValidatedPropertyReference("Property1"); ruleData.Properties.Add(propertyReference1); MockValidatorData validator11 = new MockValidatorData("validator1", true); propertyReference1.Validators.Add(validator11); validator11.MessageTemplate = "message-from-config1-RuleA"; ValidationFactory.SetDefaultConfigurationValidatorFactory(configurationSource); ValidatorFactory factory = ValidationFactory.DefaultCompositeValidatorFactory; var validator = factory.CreateValidator <BaseTestDomainObject>("RuleA"); var results = validator.Validate(new BaseTestDomainObject()); Assert.IsNotNull(factory); Assert.IsFalse(results.IsValid); Assert.AreEqual(validator11.MessageTemplate, results.ElementAt(0).Message); }
int validate() { int returncode = 0; // Example from https://stackoverflow.com/questions/53399139/fhir-net-api-stu3-validating // https://www.devdays.com/wp-content/uploads/2019/02/DD18-US-Validation-in-NET-and-Java-Ewout-Kramer-James-Agnew-2018-06-19.pdf // https://blog.fire.ly/2016/10/27/validation-and-other-new-features-in-the-net-api-stack/ // setup the resolver to use specification.zip, and a folder with custom profiles var source = new CachedResolver(new MultiResolver( new DirectorySource(@"C:\Users\dag\source\repos\FhirTool\SfmFhir\Profiles\"), ZipSource.CreateValidationSource())); // prepare the settings for the validator var ctx = new ValidationSettings() { ResourceResolver = source, GenerateSnapshot = true, Trace = false, EnableXsdValidation = true, ResolveExternalReferences = false }; var validator = new Validator(ctx); // validate the resource; optionally enter a custom profile url as 2nd parameter var result = validator.Validate(this); return(returncode); }
private ValidationSettings(ValidationSettings other) { Audience = other.Audience?.ToArray(); HostedDomain = other.HostedDomain; Clock = other.Clock; ForceGoogleCertRefresh = other.ForceGoogleCertRefresh; }
static void Main(string[] args) { Console.WriteLine("\nMySequenceWithError"); ShowValidationResults(ActivityValidationServices.Validate( MySequenceWithError())); Console.WriteLine("\nMySequenceNoError"); ShowValidationResults(ActivityValidationServices.Validate( MySequenceNoError())); Console.WriteLine("\nWhileAndWriteLineError"); ValidationSettings settings = new ValidationSettings(); settings.AdditionalConstraints.Add( typeof(WriteLine), new List <Constraint> { WhileParentConstraint.GetConstraint() }); ShowValidationResults(ActivityValidationServices.Validate( WhileAndWriteLine(), settings)); Console.WriteLine("\nWhileAndWriteLineNoError"); ShowValidationResults(ActivityValidationServices.Validate( WhileAndWriteLine())); }
// internal for testing internal static async Task <Payload> ValidateInternalAsync(string jwt, ValidationSettings validationSettings) { var settings = validationSettings.ThrowIfNull(nameof(validationSettings)).Clone(); var verificationOptions = validationSettings.ToVerificationOptions(); var signedToken = SignedToken <Header, Payload> .FromSignedToken(jwt); // Start general validation task ... var generalValidationTask = SignedTokenVerification.VerifySignedTokenAsync(signedToken, verificationOptions, default); // ... and do Google specific validation in the meantime. // Google signed tokens must not exceed this length. // It's not clear if there's an absolute size limit for all possible tokens, // that's why this check is only here and not on SignedTokenVerification. if (jwt.Length > MaxJwtLength) { throw new InvalidJwtException($"JWT exceeds maximum allowed length of {MaxJwtLength}"); } // Google signed tokens are signed with RS256. if (signedToken.Header.Algorithm != SupportedJwtAlgorithm) { throw new InvalidJwtException($"JWT algorithm must be '{SupportedJwtAlgorithm}'"); } // Google signed tokens can contain a G Suite hosted domain claim. if (settings.HostedDomain != null && signedToken.Payload.HostedDomain != settings.HostedDomain) { throw new InvalidJwtException("JWT contains invalid 'hd' claim."); } // ... finally wait for the general verifications to be done. await generalValidationTask.ConfigureAwait(false); // All verification passed, return payload. return(signedToken.Payload); }
public void CanDeserializeSerializedSectionWithTypeWithEmptyNamedRule() { ValidationSettings rwSettings = new ValidationSettings(); ValidatedTypeReference rwStringType = new ValidatedTypeReference(typeof(string)); rwSettings.Types.Add(rwStringType); rwStringType.Rulesets.Add(new ValidationRulesetData("ruleset")); IDictionary <string, ConfigurationSection> sections = new Dictionary <string, ConfigurationSection>(); sections[ValidationSettings.SectionName] = rwSettings; using (ConfigurationFileHelper configurationFileHelper = new ConfigurationFileHelper(sections)) { IConfigurationSource configurationSource = configurationFileHelper.ConfigurationSource; ValidationSettings roSettings = configurationSource.GetSection(ValidationSettings.SectionName) as ValidationSettings; Assert.IsNotNull(roSettings); Assert.AreEqual(1, roSettings.Types.Count); Assert.AreEqual(typeof(string).FullName, roSettings.Types.Get(0).Name); Assert.AreEqual(1, roSettings.Types.Get(0).Rulesets.Count); Assert.AreEqual("ruleset", roSettings.Types.Get(0).Rulesets.Get(0).Name); } }
/// <summary> /// Validates the parsed $filter query option. /// </summary> /// <param name="filter">The parsed $filter query option.</param> /// <param name="settings">The validation settings.</param> public virtual void Validate(FilterClause filter, ValidationSettings settings) { Requires.NotNull(filter, nameof(filter)); Requires.NotNull(settings, nameof(settings)); ValidateQueryNode(filter.Expression, settings); }
public void Given() { container = new UnityContainer(); var configurationSource = new DictionaryConfigurationSource(); ValidationSettings settings = new ValidationSettings(); configurationSource.Add(ValidationSettings.SectionName, settings); ValidatedTypeReference typeReference = new ValidatedTypeReference(typeof(BaseTestDomainObject)); settings.Types.Add(typeReference); typeReference.DefaultRuleset = "RuleA"; ValidationRulesetData ruleData = new ValidationRulesetData("RuleA"); typeReference.Rulesets.Add(ruleData); ValidatedPropertyReference propertyReference1 = new ValidatedPropertyReference("Property1"); ruleData.Properties.Add(propertyReference1); MockValidatorData validator11 = new MockValidatorData("validator1", true); propertyReference1.Validators.Add(validator11); validator11.MessageTemplate = "message-from-config1-RuleA"; MockValidatorData validator12 = new MockValidatorData("validator2", true); propertyReference1.Validators.Add(validator12); validator12.MessageTemplate = "message-from-config2-RuleA"; MockValidatorData validator13 = new MockValidatorData("validator3", false); propertyReference1.Validators.Add(validator13); validator13.MessageTemplate = "message-from-config3-RuleA"; var typeRegistrationProvider = new ValidationTypeRegistrationProvider(); var configurator = new UnityContainerConfigurator(container); configurator.RegisterAll(configurationSource, typeRegistrationProvider); }
private static IConfigurationSource GetNotNullValidationConfig() { var validatorData = new NotNullValidatorData() { Name = "Not Null", MessageTemplate = "City cannot be null" }; var fieldRef = new ValidatedFieldReference() { Name = "City" }; fieldRef.Validators.Add(validatorData); var rulesetData = new ValidationRulesetData("default"); rulesetData.Fields.Add(fieldRef); var typeData = new ValidatedTypeReference(typeof(TargetAddress)); typeData.Rulesets.Add(rulesetData); typeData.DefaultRuleset = rulesetData.Name; var section = new ValidationSettings(); section.Types.Add(typeData); var configSource = new DictionaryConfigurationSource(); configSource.Add(BlockSectionNames.Validation, section); return(configSource); }
private void ValidateWorkflowInternal(Activity workflow, string runtimeAssembly, PSWorkflowValidationResults validationResults) { Tracer.WriteMessage(Facility + "Validating a workflow."); _structuredTracer.WorkflowValidationStarted(Guid.Empty); ValidationSettings validationSettings = new ValidationSettings { AdditionalConstraints = { { typeof(Activity), new List <Constraint> { ValidateActivitiesConstraint(runtimeAssembly, validationResults) } } } }; try { validationResults.Results = ActivityValidationServices.Validate(workflow, validationSettings); } catch (Exception e) { Tracer.TraceException(e); ValidationException exception = new ValidationException(Resources.ErrorWhileValidatingWorkflow, e); throw exception; } _structuredTracer.WorkflowValidationFinished(Guid.Empty); }
public void CheckSimplePatient() { var p = new Practitioner(); p.Name.Add(new HumanName().WithGiven("Brian").AndFamily("Postlethwaite")); p.BirthDateElement = new Date(1970, 1, 1); var hpi_i = new Identifier("http://ns.electronichealth.net.au/id/hi/hpii/1.0", "8003610833334085"); hpi_i.Type = new CodeableConcept("http://hl7.org/fhir/v2/0203", "NPI", "National provider identifier", "HPI-I"); p.Identifier.Add(hpi_i); var ctx = new ValidationSettings() { ResourceResolver = _source, GenerateSnapshot = true, ResolveExteralReferences = true, Trace = false }; _validator = new Validator(ctx); var report = _validator.Validate(p, new[] { "http://sqlonfhir-stu3.azurewebsites.net/fhir/StructureDefinition/0ac0bb0d1d864cee965f401f2654fbb0" }); System.Diagnostics.Trace.WriteLine(report.ToString()); Assert.IsTrue(report.Success); Assert.AreEqual(1, report.Warnings); // 1 unresolvable reference }
internal ValidationService(EditingContext context, TaskDispatcher validationTaskDispatcher) { Fx.Assert(validationTaskDispatcher != null, "validationTaskDispatcher cannot be null."); this.validationTaskDispatcher = validationTaskDispatcher; this.context = context; this.settings = new ValidationSettings { SkipValidatingRootConfiguration = true }; this.context.Services.Subscribe <ModelService>(new SubscribeServiceCallback <ModelService>(OnModelServiceAvailable)); this.context.Services.Subscribe <ModelSearchService>(new SubscribeServiceCallback <ModelSearchService>(OnModelSearchServiceAvailable)); this.context.Services.Subscribe <ObjectReferenceService>(new SubscribeServiceCallback <ObjectReferenceService>(OnObjectReferenceServiceAvailable)); this.context.Services.Subscribe <ModelTreeManager>(new SubscribeServiceCallback <ModelTreeManager>(OnModelTreeManagerAvailable)); this.context.Services.Subscribe <IValidationErrorService>(new SubscribeServiceCallback <IValidationErrorService>(OnErrorServiceAvailable)); this.context.Services.Subscribe <AttachedPropertiesService>(new SubscribeServiceCallback <AttachedPropertiesService>(OnAttachedPropertiesServiceAvailable)); AssemblyName currentAssemblyName = Assembly.GetExecutingAssembly().GetName(); StringBuilder validationKeyPath = new StringBuilder(90); validationKeyPath.Append(ValidationRegKeyInitialPath); validationKeyPath.AppendFormat("{0}{1}{2}", "v", currentAssemblyName.Version.ToString(), "\\"); validationKeyPath.Append(currentAssemblyName.Name); RegistryKey validationRegistryKey = Registry.CurrentUser.OpenSubKey(validationKeyPath.ToString()); if (validationRegistryKey != null) { object value = validationRegistryKey.GetValue(ValidationRegKeyName); this.isValidationDisabled = (value != null && string.Equals("1", value.ToString())); validationRegistryKey.Close(); } }
public void CanDeserializeSerializedSectionWithTypeWithValidatorsForNamedRule() { ValidationSettings rwSettings = new ValidationSettings(); ValidatedTypeReference rwStringType = new ValidatedTypeReference(typeof(string)); rwSettings.Types.Add(rwStringType); ValidationRulesetData rwValidationRule = new ValidationRulesetData("ruleset"); rwStringType.Rulesets.Add(rwValidationRule); ValidatorData rwValidatorData = new MockValidatorData("validator1", true); rwValidationRule.Validators.Add(rwValidatorData); IDictionary <string, ConfigurationSection> sections = new Dictionary <string, ConfigurationSection>(); sections[ValidationSettings.SectionName] = rwSettings; using (ConfigurationFileHelper configurationFileHelper = new ConfigurationFileHelper(sections)) { IConfigurationSource configurationSource = configurationFileHelper.ConfigurationSource; ValidationSettings roSettings = configurationSource.GetSection(ValidationSettings.SectionName) as ValidationSettings; Assert.IsNotNull(roSettings); Assert.AreEqual(1, roSettings.Types.Count); Assert.AreEqual(typeof(string).FullName, roSettings.Types.Get(0).Name); Assert.AreEqual(1, roSettings.Types.Get(0).Rulesets.Count); Assert.AreEqual("ruleset", roSettings.Types.Get(0).Rulesets.Get(0).Name); Assert.AreEqual(1, roSettings.Types.Get(0).Rulesets.Get(0).Validators.Count); Assert.AreEqual("validator1", roSettings.Types.Get(0).Rulesets.Get(0).Validators.Get(0).Name); Assert.AreSame(typeof(MockValidatorData), roSettings.Types.Get(0).Rulesets.Get(0).Validators.Get(0).GetType()); Assert.AreEqual(true, ((MockValidatorData)roSettings.Types.Get(0).Rulesets.Get(0).Validators.Get(0)).ReturnFailure); } }
public void Setup() { var assembly = Assembly.GetExecutingAssembly(); var location = new Uri(assembly.GetName().CodeBase); var directoryInfo = new FileInfo(location.AbsolutePath).Directory; Debug.Assert(directoryInfo != null, "directoryInfo != null"); Debug.Assert(directoryInfo.FullName != null, "directoryInfo.FullName != null"); var structureDefinitions = directoryInfo.FullName + @"\Resources\StructureDefinitions"; var includeSubDirectories = new DirectorySourceSettings { IncludeSubDirectories = true }; var directorySource = new DirectorySource(structureDefinitions, includeSubDirectories); var cachedResolver = new CachedResolver(directorySource); var coreSource = new CachedResolver(ZipSource.CreateValidationSource()); var combinedSource = new MultiResolver(cachedResolver, coreSource); var settings = new ValidationSettings { EnableXsdValidation = true, GenerateSnapshot = true, Trace = true, ResourceResolver = combinedSource, ResolveExteralReferences = true, SkipConstraintValidation = false }; var validator = new Validator(settings); _profileValidator = new ProfileValidator(validator); }
protected override void Arrange() { base.Arrange(); var section = new ValidationSettings() { Types = { new ValidatedTypeReference(typeof(given_string_length_validator_with_lower_greater_than_upper)) { Rulesets = { new ValidationRulesetData("ruleSet") { Validators = { new AndCompositeValidatorData("AndComposite1") { Validators = { new StringLengthValidatorData() { LowerBound = 10, UpperBound = 0, LowerBoundType = Microsoft.Practices.EnterpriseLibrary.Validation.Validators.RangeBoundaryType.Ignore } } } } } } } } }; ValidationViewModel = SectionViewModel.CreateSection(Container, ValidationSettings.SectionName, section); Container.Resolve <ElementLookup>().AddSection(ValidationViewModel); }
public void SetupSource() { // Ensure the FHIR extensions are registered Hl7.Fhir.FhirPath.PocoNavigatorExtensions.PrepareFhirSymbolTableFunctions(); // Prepare the artifact resolvers (cache to reduce complexity) _source = new CachedResolver( new MultiResolver( // Use the specification zip that is local (from the NuGet package) new ZipSource("specification.zip"), // Try using the fixed content new AustralianFhirProfileResolver(), // Then look to a specific FHIR Registry Server new WebResolver(id => new FhirClient("http://sqlonfhir-stu3.azurewebsites.net/fhir")) ) ); var ctx = new ValidationSettings() { ResourceResolver = _source, GenerateSnapshot = true, EnableXsdValidation = true, Trace = false, ResolveExteralReferences = true }; // until we have a local terminology service ready, here is the remote implementation // ctx.TerminologyService = new ExternalTerminologyService(new FhirClient("http://test.fhir.org/r3")); ctx.TerminologyService = new LocalTerminologyServer(_source); _validator = new Validator(ctx); }
private void ValidateAllowed(AllowedOptions option, ValidationSettings settings) { if (!settings.AllowedOptions.HasFlag(option)) { throw new ODataException($"The '{option}' query option is not allowed."); } }
///<summary> ///</summary> ///<param name="validationSettings"></param> public ConfigurationValidatorBuilder(ValidationSettings validationSettings) : this( validationSettings, MemberAccessValidatorBuilderFactory.Default, ValidationFactory.DefaultCompositeValidatorFactory) { }
/// <summary> /// Verifies that a workflow activity on an <see cref="ActivityActor"/> is correctly configured according to /// the validation logic. This logic can be the <see cref="CodeActivity.CacheMetadata(CodeActivityMetadata)"/> /// method of the activities to validate, or build and policy constraints. /// </summary> /// <param name="toValidate"></param> /// <param name="settings"></param> /// <returns></returns> public static ValidationResults Validate(ActivityActor toValidate, ValidationSettings settings) { Contract.Requires <ArgumentNullException>(toValidate != null); Contract.Requires <ArgumentNullException>(settings != null); return(ActivityValidationServices.Validate(toValidate.CreateActivityInternal(), settings)); }
/// <summary> /// Validate the object. /// </summary> /// <exception cref="ValidationException"> /// Thrown if validation fails /// </exception> public virtual void Validate() { if (MessageConnectionSettings == null) { throw new ValidationException(ValidationRules.CannotBeNull, "MessageConnectionSettings"); } if (AcknowledgementConnectionSettings == null) { throw new ValidationException(ValidationRules.CannotBeNull, "AcknowledgementConnectionSettings"); } if (MdnSettings == null) { throw new ValidationException(ValidationRules.CannotBeNull, "MdnSettings"); } if (SecuritySettings == null) { throw new ValidationException(ValidationRules.CannotBeNull, "SecuritySettings"); } if (ValidationSettings == null) { throw new ValidationException(ValidationRules.CannotBeNull, "ValidationSettings"); } if (EnvelopeSettings == null) { throw new ValidationException(ValidationRules.CannotBeNull, "EnvelopeSettings"); } if (ErrorSettings == null) { throw new ValidationException(ValidationRules.CannotBeNull, "ErrorSettings"); } if (MessageConnectionSettings != null) { MessageConnectionSettings.Validate(); } if (AcknowledgementConnectionSettings != null) { AcknowledgementConnectionSettings.Validate(); } if (MdnSettings != null) { MdnSettings.Validate(); } if (SecuritySettings != null) { SecuritySettings.Validate(); } if (ValidationSettings != null) { ValidationSettings.Validate(); } if (EnvelopeSettings != null) { EnvelopeSettings.Validate(); } if (ErrorSettings != null) { ErrorSettings.Validate(); } }
public AnalyzeService(NSCRegDbContext context, StatUnitAnalysisRules analysisRules, DbMandatoryFields mandatoryFields, ValidationSettings validationSettings) { _context = context; _analysisRules = analysisRules; _mandatoryFields = mandatoryFields; _helper = new StatUnitAnalysisHelper(_context); _validationSettings = validationSettings; }
public static ProcessActivityTreeOptions GetValidationOptions(ValidationSettings settings) { if (settings.SingleLevel) { return(SingleLevelValidationOptions); } return(ValidationOptions); }
/// <summary> /// Uses the specified validation settings for the convention. /// </summary> /// <param name="validationSettings">The <see cref="ODataValidationSettings">validation settings</see> to use.</param> /// <returns>The original <see cref="ODataActionQueryOptionsConventionBuilder{T}"/>.</returns> public virtual ODataActionQueryOptionsConventionBuilder <T> Use(ODataValidationSettings validationSettings) { Arg.NotNull(validationSettings, nameof(validationSettings)); Contract.Ensures(Contract.Result <ODataActionQueryOptionsConventionBuilder <T> >() != null); ValidationSettings.CopyFrom(validationSettings); return(this); }
///<summary> ///</summary> ///<param name="validationSettings"></param> ///<param name="memberAccessValidatorFactory"></param> ///<param name="validatorFactory"></param> public ConfigurationValidatorBuilder( ValidationSettings validationSettings, MemberAccessValidatorBuilderFactory memberAccessValidatorFactory, ValidatorFactory validatorFactory) : base(memberAccessValidatorFactory, validatorFactory) { this.validationSettings = validationSettings; }
public ValidationBuilder() { _validationSettings = new ValidationSettings { CssClass_Callout = "validatorCallout", CssClass_CalloutHighlight = "validatorCallout-highlight", ImgPath_CalloutWarning = "/style/img/warning-large.gif" }; }
/// <summary> /// Validates the parsed $skip query option. /// </summary> /// <param name="skip">The parsed $skip query option.</param> /// <param name="settings">The validation settings.</param> public virtual void Validate(long?skip, ValidationSettings settings) { Requires.NotNull(settings, nameof(settings)); if (skip > settings.MaxSkip) { throw new ODataException("The $skip query option exceeded the ValidationSettiongs.MaxSkip value."); } }
public void no_modifications_from_the_settings() { var call = ActionCall.For<SampleInputModel>(x => x.Test(null)); var chain = new BehaviorChain(); chain.AddToEnd(call); var settings = new ValidationSettings(); settings.ForInputType<int>(x => { x.Clear(); x.RegisterStrategy(RenderingStrategies.Inline); }); ValidationConvention.ApplyValidation(call, settings); chain.ValidationNode().ShouldHaveTheSameElementsAs(RenderingStrategies.Summary, RenderingStrategies.Highlight); }
public ValidationSettings Build() { blockSettings = new ValidationSettings(); if (!blockSettingsNode.RequirePermission) // don't set if false blockSettings.SectionInformation.RequirePermission = blockSettingsNode.RequirePermission; foreach (TypeNode typeNode in blockSettingsNode.Hierarchy.FindNodesByType(typeof(TypeNode))) { ValidatedTypeReference typeReference = new ValidatedTypeReference(); typeReference.Name = typeNode.TypeName; typeReference.AssemblyName = typeNode.AssemblyName; if (typeNode.DefaultRule != null) { typeReference.DefaultRuleset = typeNode.DefaultRule.Name; } BuildRules(typeReference, typeNode); blockSettings.Types.Add(typeReference); } return blockSettings; }
public ValidationBuilder(ValidationSettings settings) { _validationSettings = settings; }
/// <summary> /// Initializes a new instance of the SpreadsheetDocumentValidator. /// </summary> /// <param name="settings">The validation settings.</param> /// <param name="schemaValidator">The schema validator to be used for schema validation.</param> /// <param name="semanticValidator">The semantic validator to be used for semantic validation.</param> internal SpreadsheetDocumentValidator(ValidationSettings settings, SchemaValidator schemaValidator, SemanticValidator semanticValidator) : base(settings, schemaValidator, semanticValidator) { }
public RemoteRuleQuery(ValidationSettings settings) { _filters = settings.Filters; }
public ValidatorBuilder(string groupIdentifier, ValidationSettings setting) { _groupIdentifier = groupIdentifier; _settings = setting; }
public ValidationGroup(ValidationBuilder validationBuilder, ValidationSettings settings, string validationGroupId) { _validationBuilder = validationBuilder; _groupIdentifier = validationGroupId; _validatorBuilder = new ValidatorBuilder(_groupIdentifier, settings); }
/// <summary> /// Initializes a new instance of the WordprocessingDocumentValidator. /// </summary> /// <param name="settings">The validation settings.</param> /// <param name="schemaValidator">The schema validator to be used for schema validation.</param> /// <param name="semanticValidator">The semantic validator to be used for semantic validation.</param> internal WordprocessingDocumentValidator(ValidationSettings settings, SchemaValidator schemaValidator, SemanticValidator semanticValidator) : base(settings, schemaValidator, semanticValidator) { }
/// <summary> /// Initializes a new instance of the PresentationDocumentValidator. /// </summary> /// <param name="settings">The validation settings.</param> /// <param name="schemaValidator">The schema validator to be used for schema validation.</param> /// <param name="semanticValidator">The semantic validator to be used for semantic validation.</param> internal PresentationDocumentValidator(ValidationSettings settings, SchemaValidator schemaValidator, SemanticValidator semanticValidator) : base(settings, schemaValidator, semanticValidator) { }
public void SetUp() { theSettings = new ValidationSettings(); }