private void TestCore(string resultName, string expectedName, string typeName, string value, string stepText) { string compareText = GetCompareText(stepText); CompareOp compareOp = ToCompareOp(compareText); //Console.WriteLine($"***** Testing: result name: <{resultName}>, expected name: <{expectedName}>, type name: <{typeName}>, compare: <{compareOp}>, value: <{value}>"); ITypeProcessor expected = null; if (!IsSingleCompareOp(compareOp)) { if (!_manager.GetProcessorForExistingName(expectedName, out expected)) { expected = _manager.GetProcessorFor(typeName, value); } } if (expected == null)// && string.IsNullOrWhiteSpace(resultName)) { expected = new ObjectProcessor(_scenario); expected.PostCurrentValue(); } ITypeProcessor actual = _manager.GetProcessorForExistingName(resultName); DoCompare(actual, expected, compareOp); }
private void PropertyTestImpl( string propNameOrValueKey, string keyOrTypeName, string keyOrValue, string stepText, bool isValue, string propName2 = null, string keyOrTypeName2 = null) { string compareText = GetCompareText(stepText); CompareOp compareOp = ToCompareOp(compareText); //Console.WriteLine($"***** PropertyTest: propName: <{propNameOrValueKey}>, keyOrTypeName: <{keyOrTypeName}>, keyOrValue: <{keyOrValue}>, compare: <{compareOp}>, propName2: <{propName2}>, keyOrTypeName2: <{keyOrTypeName2}>"); GetPropertyOrFieldData(propNameOrValueKey, keyOrTypeName, out object instance, out PropertyInfo prop, out FieldInfo field); GetPropertyOrFieldData(propName2, keyOrTypeName2, out object instance2, out PropertyInfo prop2, out FieldInfo field2); ITypeProcessor actual = GetProcessorFor(propNameOrValueKey, instance, prop, field); ITypeProcessor expected = null; if (!IsSingleCompareOp(compareOp)) { if (isValue) { expected = actual.Clone(); expected.SetValue(keyOrValue); } else { expected = GetProcessorFor(keyOrValue, instance2, prop2, field2); } } if (expected == null) { expected = new ObjectProcessor(_scenario); expected.PostCurrentValue(); } DoCompare(actual, expected, compareOp); }