protected static void DoCompare(ITypeProcessor actual, ITypeProcessor expected, CompareOp compareOp) { if (actual == null) { if (expected != null) { actual = expected.Clone(); actual.ReadFromContext(); } } Console.WriteLine($"***** Actual: {(actual != null ? actual.ToString() : "NULL")}"); Console.WriteLine($"***** Expected: {(expected != null ? expected.ToString() : "NULL")}"); if (actual == null || (expected == null && !IsSingleCompareOp(compareOp))) { throw new Exception($"Unable to parse test step."); } actual.CompareTo(expected, compareOp); }
private void TestCollectionCore(string collectionKind, string resultName, string typeName, string value, string stepText) { string compareText = GetCompareText(stepText); CompareOp compareOp = ToCompareOp(compareText); //Console.WriteLine($"***** Testing Collection: collection kind: <{collectionKind}>, result name: <{resultName}>, type name: <{typeName}>, compare: <{compareOp}>, value: <{value}>"); ITypeProcessor actual = _manager.GetCollectionProcessorForExistingName(resultName); ITypeProcessor expected = null; if (!IsSingleCompareOp(compareOp)) { expected = _manager.GetCollectionProcessorFor(collectionKind, typeName, value); } else if (compareOp == CompareOp.Null || compareOp == CompareOp.NotNull) { if (actual == null) { actual = _manager.GetCollectionProcessorFor(collectionKind, typeName, null); actual?.ReadFromContext(); } } DoCompare(actual, expected, compareOp); }