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?
var ds = new DataStore("d_department", context);
// Inserts an empty row before the first row of datastore.
ds.SetItem(0, "action", "A");
var packer = new DataPacker();
var result = service.GetDepartments(packer, out errmsg);