public void GivenAConfigWithoutProcessingErrorsField_WhenCreateAnonymizerConfigurationManager_TheFieldShouldBeDefaultAsRaise() { var configFilePath = "./TestConfigurations/configuration-without-processing-error.json"; var configurationManager = AnonymizerConfigurationManager.CreateFromConfigurationFile(configFilePath); Assert.Equal(ProcessingErrorsOption.Raise, configurationManager.Configuration.processingErrors); }
public void GivenADateShiftKeyPrefix_WhenSet_DateShiftKeyPrefixShouldBeSetCorrectly(string dateShiftKeyPrefix) { var configFilePath = "./TestConfigurations/configuration-test-sample.json"; var configurationManager = AnonymizerConfigurationManager.CreateFromConfigurationFile(configFilePath); configurationManager.SetDateShiftKeyPrefix(dateShiftKeyPrefix); Assert.Equal(dateShiftKeyPrefix, configurationManager.GetParameterConfiguration().DateShiftKeyPrefix); }
public void GivenAValidConfig_WhenCreateAnonymizerConfigurationManager_ConfigurationShouldBeLoaded(string configFilePath) { var configurationManager = AnonymizerConfigurationManager.CreateFromConfigurationFile(configFilePath); var patientRules = configurationManager.GetPathRulesByResourceType("Patient"); Assert.True(patientRules.Any()); var typeRules = configurationManager.GetTypeRules(); Assert.True(typeRules.Any()); var parameters = configurationManager.GetParameterConfiguration(); Assert.True(!string.IsNullOrEmpty(parameters.DateShiftKey)); }
public void GivenAValidConfig_WhenCreateAnonymizerConfigurationManager_ConfigurationShouldBeLoaded(string configFilePath) { var configurationManager = AnonymizerConfigurationManager.CreateFromConfigurationFile(configFilePath); var fhirRules = configurationManager.FhirPathRules; Assert.True(fhirRules.Any()); fhirRules = configurationManager.FhirPathRules; Assert.Single(configurationManager.FhirPathRules.Where(r => "Patient".Equals(r.ResourceType))); Assert.Single(configurationManager.FhirPathRules.Where(r => "TestResource".Equals(r.ResourceType))); Assert.Single(configurationManager.FhirPathRules.Where(r => string.IsNullOrEmpty(r.ResourceType))); Assert.Single(configurationManager.FhirPathRules.Where(r => "Resource".Equals(r.ResourceType))); var parameters = configurationManager.GetParameterConfiguration(); Assert.True(!string.IsNullOrEmpty(parameters.DateShiftKey)); }
public void GivenAnInvalidConfig_WhenCreateAnonymizerConfigurationManager_ExceptionShouldBeThrown(string configFilePath) { Assert.Throws <AnonymizerConfigurationErrorsException>(() => AnonymizerConfigurationManager.CreateFromConfigurationFile(configFilePath)); }