Пример #1
0
        public void CanConvertTemplateWithRepeatingParameters()
        {
            string template        = @"feijf{0}[^epoaijf\]{1}\\]{1}\]";
            string formattedString = string.Format(template, replacements);
            Regex  templateRegex   = TemplateStringTester.Translate(template);

            Assert.IsTrue(templateRegex.IsMatch(formattedString));
        }
Пример #2
0
        public void ConvertedTemplateWithRepeatingParametersDoesHonorParameterIdentity()
        {
            string template        = @"feijf{0}[^epoaijf\]{1}\\]{1}\]";
            string promiscuous     = @"feijf{0}[^epoaijf\]{1}\\]{2}\]";                         // will use parameter 2 instead of parameter 1
            string formattedString = string.Format(promiscuous, replacements);
            Regex  templateRegex   = TemplateStringTester.Translate(template);

            Assert.IsFalse(templateRegex.IsMatch(formattedString));
        }