public void WhenTwoCapturesGiven_ExpectTwo() { Command command = new Command("^(?<name>[a-z]+).*?(?<second>[0-9]+)"); Pickup pickup = new Pickup(); pickup.CollectAllPickupsInLine("ab c 45", command); var results = pickup.ReplacePickupsWithStoredValue("${name}"); Assert.AreEqual("ab", results); results = pickup.ReplacePickupsWithStoredValue("${second}"); Assert.AreEqual("45",results); }
public void ExpandPickupWithOutAnExplicitPattern() { Pickup sh = new Pickup(); string results = sh.ReplaceShorthandPatternWithFormalRegex("ab{test} d"); Assert.AreEqual("ab(?<test>.*?) d",results); }
public void WhenSameCaptureNameReused_ExpectLastValue() { Command command = new Command(@"^(?<name>[a-z]+).*?(?<name>[0-9]+)"); Pickup pickup = new Pickup(); pickup.CollectAllPickupsInLine("ab c 45", command); var results = pickup.ReplacePickupsWithStoredValue("${name}"); Assert.AreEqual("45", results); }
public void ExpandPickupWithAnExplicitPattern(string line, string expectedResults) { Pickup sh = new Pickup(); string results = sh.ReplaceShorthandPatternWithFormalRegex(line); Assert.AreEqual(expectedResults, results); }
public void ClearPickupList() { Pickup pickup = new Pickup(); pickup.ClearPickupList(); }
public void WhenGlobPickup_ExpectHeldValue() { Command command = new Command(@"a{name}d"); Pickup pickup = new Pickup(); pickup.CollectAllPickupsInLine("ab cd",command); string results = pickup.ReplacePickupsWithStoredValue("ab${name}"); Assert.AreEqual("abb c", results); }
public ReplaceTokens() { _pickup = new Pickup(); }