c# - Unable to read key value pair from hashtable -
i writing specflow test service. reading table , storing key,values in hashtable.
here sample of feature file:
|index|id | message| |test1|1 | aa| |test2|2 | bb | here how read data table
public hashtable getdata(table table) { var data = table.createset<specflowdata>(); var hashtable = new hashtable(); foreach (var currentrow in data) { var key = currentrow.index; var value = getvalues(currentrow); hashtable.add(key, value); } return hashtable; } here trying extract key , value pair in hashtable
[when(@"the test data submitted service")] public void whenthetestdataissubmittedservice() { // table data stored in textcontext var message = testcontext.messages; byte? result = null; foreach (hashtable entry in message) { var values = entry.values; // problem area foreach (hashtable item in values) { var ids = item["id"]; var messages = item["message"]; // send message service accepts string,string input sendmessageresult = client.sendmessagetoservice((string)appids, (string)messages); } } } since values have own key value pair ..i tried access in second loop not looping collection of hashtable values.
i don't understand why can't loop value collections in second loop
once replace hashtable dictionary able access data.
Comments
Post a Comment