我想拥有以下测试步骤类结构:
[Binding]
public class BaseStep
{
[Given(@"there is a customer")]
public void GivenThereIsACustomer(Table table)
{
HandleCustomer(table);
}
protected virtual void HandleCustomer(Table table)
{
}
}
[Binding]
public class FeatureOneStep : BaseStep
{
protected override void HandleCustomer(Table table)
{
// feature one action
}
[Given(@"feature one specific step")]
public void GivenFeatureOneSpecificAction(Table table)
{
// do something
}
}
[Binding]
public class FeatureTwoStep : BaseStep
{
protected override void HandleCustomer(Table table)
{
// feature two action
}
[Given(@"feature two specific step")]
public …Run Code Online (Sandbox Code Playgroud) 我有以下ServiceContract和DataContract类:
[ServiceContract]
public interface IWcfService
{
[OperationContract]
Response GetData();
}
[DataContract]
public class Response
{
[DataMember]
public Dictionary<string, object> Data { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
当Response.Data字典的值为int,string,double或任何其他"简单"基元类型时,WCF可以成功序列化该对象.但是当Response.Data字典的值为List <string>类型时,客户端在接收到数据并尝试反序列化时抛出以下异常:
Message=The formatter threw an exception while trying to deserialize the message:
There was an error while trying to deserialize parameter http://tempuri.org/:GetDataResult.
The InnerException message was 'Error in line 1 position 990.
Element 'http://schemas.microsoft.com/2003/10/Serialization/Arrays:Value' contains data from a type
that maps to the name 'http://schemas.microsoft.com/2003/10/Serialization/Arrays:ArrayOfstring'.
The deserializer has no knowledge of any type that …Run Code Online (Sandbox Code Playgroud)