Issue with reading Options in test harness - Options.HasProperty(string property) is failing (6 replies)
I'm trying to adjust to the 4.0 test harness, but I'm having issues.
In PullDataOrderTest I have specific order reader tests, and in each test I attempt to set Options using TransformDefinition.Options.SetProperty("Option1", "Option1Value", true). When I step through the code I see that SetProperty() will add a value (TransformDefinition.Options now contains "Option1"). However, when I attempt to call TransformDefinition.Options.GetProperty("Option1") I get a NullReferenceException. This is especially unexpected because TransformDefinition.Options.HasProperty("Option1") is returning True.
How should I be setting Options in the Test harness?
Is "HasProperty()" broken? Should I be checking a different way?
Am I missing something else?
HasProperty isn't broken.
Can you please send a sample of your code?
Sure, there are 3 screenshots - not sure which order they'll appear in after I attach
- PullDataInterop.Initialize() calls GetReaderOptions(transformDef)
- GetReaderOptions(transformDef) calls GetReaderOptionValue(transformDef, string)
- GetReaderOptionValue(transformDef, string) calls transformDef.Options.HasProperty(string) which is returning true
What happens when you just go GetProperty?
I see what's wrong...
SetProperty("Option1", "Option1Value", true)
SetProperty("Option1", "Option1Value", false)
The last argument indicates whether you need to set a list property vs. a single value.
When I call simply "GetProperty" I get the NullReferenceException
However, when I attempt to call TransformDefinition.Options.GetProperty("Option1") I get a NullReferenceException.
Thanks for the "SetProperty" hint.
I was getting it mixed up with Transaction.SetFieldValue(field, value, true/false)