public void ValidateParseErrorUselessFixedString() { string path = "\"Safari\""; TestMatcher matcher = new TestMatcher(new Dictionary <string, IDictionary <string, string> >(), new Dictionary <string, ISet <string> >()); MatcherRequireAction action = new MatcherRequireAction(path, matcher); Action a = new Action(() => action.Initialize()); a.Should().Throw <InvalidParserConfigurationException>(); }
private void CheckPath(string path, string[] expectedHashEntries, string[] expectedWalkList) { var lookups = new Dictionary <string, IDictionary <string, string> > { ["TridentVersions"] = new Dictionary <string, string>() }; var matcher = new TestMatcher(lookups, new Dictionary <string, ISet <string> >()); var action = new MatcherRequireAction(path, matcher); action.Initialize(); var sb = new StringBuilder("\n---------------------------\nActual list (") .Append(matcher.receivedValues.Count) .Append(" entries):\n"); foreach (string actual in matcher.receivedValues) { sb.Append(actual).Append('\n'); } sb.Append("---------------------------\n"); // Validate the expected hash entries (i.e. the first part of the path) foreach (string expect in expectedHashEntries) { matcher.receivedValues.Contains(expect).Should().BeTrue("\nExpected:\n" + expect + sb.ToString()); } expectedHashEntries.Length.Should().Be(matcher.receivedValues.Count, "Found that number of entries"); // Validate the expected walk list entries (i.e. the dynamic part of the path) TreeExpressionEvaluator evaluator = action.EvaluatorForUnitTesting; WalkList walkList = evaluator.WalkListForUnitTesting; var step = walkList.FirstStep; foreach (string walkStep in expectedWalkList) { step.Should().NotBeNull("Step: " + walkStep); walkStep.Should().Be(step.ToString(), "step(" + step.ToString() + " should be " + walkStep + ")"); step = step.NextStep; } step.Should().BeNull(); }