- Thomas Rolseth
- SnapDevelop
- Tuesday, 18 February 2020 05:08 PM UTC
I am creating a unit test (XUnit) for a service in SnapDevelop. The service method takes a DataUnPacker object as a parameter. This gets passed to the API from PowerBuilder using the jsonpackage object. My question is how can I populate this in a C# unit test before calling the service? I have the following code so far -- see below. My idea was to insert some rows into a datastore, instantiate a new packer object, add the datastore to it and then pass it to the service (in bold). It doesn't like the datatype however and I can't compile. Is there a way to convert the packer object to an unpacker object? Is there a better way to handle this situation?
Thanks, Tom
var ds = new DataStore("d_department", context);
ds.Retrieve();
// Inserts an empty row before the first row of datastore.
ds.InsertRow(0);
ds.SetItem(0, "action", "A");
var packer = new DataPacker();
packer.AddDataStore("Departments", ds);
var result = service.GetDepartments(packer, out errmsg);
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.