Back to SDK Support...

Issue with reading Options in test harness - Options.HasProperty(string property) is failing (6 replies)

Randy
6 years ago
Randy 6 years ago

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?

https://www.realisable.co.uk/wp-content/uploads/2018/10/devenv_2018-10-24_15-45-48.png
https://www.realisable.co.uk/wp-content/uploads/2018/10/devenv_2018-10-24_15-44-29.png
https://www.realisable.co.uk/wp-content/uploads/2018/10/devenv_2018-10-24_15-44-10.png
Support
6 years ago
Support 6 years ago

HasProperty isn't broken.

Can you please send a sample of your code?

Randy
6 years ago
Randy 6 years ago

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
https://www.realisable.co.uk/wp-content/uploads/2018/10/devenv_2018-10-29_08-37-21.png
https://www.realisable.co.uk/wp-content/uploads/2018/10/devenv_2018-10-29_08-38-29.png
https://www.realisable.co.uk/wp-content/uploads/2018/10/devenv_2018-10-29_08-38-00.png
Support
6 years ago
Support 6 years ago

What happens when you just go GetProperty?

Support
6 years ago
Support 6 years ago

I see what's wrong...

Change....

SetProperty("Option1", "Option1Value", true)

to 

SetProperty("Option1", "Option1Value", false)

The last argument indicates whether you need to set a list property vs. a single value.

 

Randy
6 years ago
Randy 6 years ago

When I call simply "GetProperty" I get the NullReferenceException

However, when I attempt to call TransformDefinition.Options.GetProperty("Option1") I get a NullReferenceException.

Randy
6 years ago
Randy 6 years ago

Thanks for the "SetProperty" hint.

I was getting it mixed up with Transaction.SetFieldValue(field, value, true/false)

Contact

Realisable Software Ltd provides code-free, cost-effective applications integration solutions for SMEs. Our core IMan product is designed to integrate almost any application with a number of Sage solutions and online payment processors.

Looking to purchase IMan, please see our resellers here.

Realisable Software
Ph: +44 (0) 208 123 1017

Copyright © Realisable. All rights reserved.
Realisable is a registered trademark

Close

Request Demo

Realisable Software Ltd provides code-free, cost-effective applications integration solutions for SMEs. Our core IMan product is designed to integrate almost any application with a number of Sage solutions and online payment processors.

Looking to purchase IMan, please see our resellers here.

Realisable Software
Ph: +44 (0) 208 123 1017

Copyright © Realisable. All rights reserved.
Realisable is a registered trademark

Close

Access Downloads

Realisable Software Ltd provides code-free, cost-effective applications integration solutions for SMEs. Our core IMan product is designed to integrate almost any application with a number of Sage solutions and online payment processors.

Looking to purchase IMan, please see our resellers here.

Realisable Software
Ph: +44 (0) 208 123 1017

Copyright © Realisable. All rights reserved.
Realisable is a registered trademark

Close