我正在使用 FitNesse 和 SLIM,我希望能够将对象传递给方法,但似乎不知道如何?你如何使用 SLIM 做到这一点?
所以例如我想建立一个调用对象
!|FitTesting.MakeCall |
|ANI |Call Type|Call Id|Call Key No| Data|
|4403951403|2 |2000 |8000 |5000 |
我想将该对象存储在符号或变量名中CallObject
然后我想在 Start Call 方法中使用该对象。
|script | FitTesting.PracticeCallTestFixture|
|Initialize Call Fixture|
|Start Call|<<With Call Object>>
|check|Check For Call|true|
|Finalize Phone Desktop|
我尝试使用字典,但出现以下异常
EXCEPTION_:fitSharp.Machine.Exception.ParseException1[System.String]: Parse parameter 1 for 'UpdateECCData' type System.Collections.Generic.Dictionary
2[System.String,System.String] failed. ---> System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at fitSharp.Machine.Model.BranchList1.get_Item(Int32 index)
at fitSharp.Slim.Operators.ParseDictionary.Parse(Type type, TypedValue instance, Tree
1 parameters)
at fitSharp.Machine.Engine.ProcessorBase2.<>c__DisplayClass11.<>c__DisplayClass13.<Parse>b__10(ParseOperator
1 o)
at fitSharp.Machine.Engine.ProcessorBase2.<>c__DisplayClass11.<Parse>b__e(OperationLogging logging)
at fitSharp.Machine.Engine.ProcessorBase
2.DoLoggedOperation[R](String startMessage, Func2 operation)
at fitSharp.Machine.Engine.ParameterList
1.ParseParameterValue(RuntimeMember member, TypedValue instance, Tree1 parameter, Int32 parameterIndex)
--- End of inner exception stack trace ---
at fitSharp.Machine.Engine.ParameterList
1.ParseParameterValue(RuntimeMember member, TypedValue instance, Tree1 parameter, Int32 parameterIndex)
at fitSharp.Machine.Engine.ParameterList
1.<>c_DisplayClass1.b_0(List1 parameterList, Tree
1 parameter)
at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable1 source, TAccumulate seed, Func
3 func)
at fitSharp.Machine.Engine.ParameterList1.GetParameterList(TypedValue instance, Tree
1 parameters, RuntimeMember member)
at fitSharp.Machine.Engine.InvokeDefault2.Invoke(TypedValue instance, String memberName, Tree
1 parameters)
at fitSharp.Slim.Operators.InvokeLibrary.Invoke(TypedValue instance, String memberName, Tree1 parameters)
at fitSharp.Machine.Engine.ProcessorBase
2.<>c_DisplayClass18.<>c_DisplayClass1a.b_17(InvokeOperator1 o)
at fitSharp.Machine.Engine.ProcessorBase
2.<>c_DisplayClass18.b_15(OperationLogging logging)
at fitSharp.Machine.Engine.ProcessorBase2.DoLoggedOperation[R](String startMessage, Func
2 operation)
at fitSharp.Slim.Operators.InvokeInstructionBase.InvokeMember(Tree1 parameters, Int32 memberIndex)
at fitSharp.Slim.Operators.ExecuteCall.ExecuteOperation(Tree
1 parameters)
at fitSharp.Slim.Operators.InvokeInstructionBase.Invoke(TypedValue instance, String memberName, Tree`1 parameters)
这是适合标记
!|FitTestingConnectCTI.MakeCall |
|ANI |Call Type|Router Call Key Id|Router Call Key Day|Update ECC Data |
|4403951403|2 |2000 |5000 |!{ANI:4403951403,StateAbbr:OH} |
这是我的方法调用
public void UpdateECCData(Dictionary<string,string> eccDictionary)
{
if (eccDictionary != null)
{
if (eccDictionary.Count > 0)
{
foreach (KeyValuePair<string, string> keyValuePair in eccDictionary)
{
ECCData.Add(keyValuePair.Key,keyValuePair.Value);
}
}
}
}