Esempio n. 1
0
        public void TestNonStringFormatFunctions()
        {
            var model = new StringTagModel();

            model.Add(this);

            using (new TemporaryRegistration(new DateTimeStringTagProvider())) {
                Assert.AreEqual(StringParserService.Parse("${FIXEDTIME:d}", model), DateTimeStringTagProvider.Value.ToString("d"));
            }
        }
Esempio n. 2
0
        public void TestFormatFunctions()
        {
            var model = new StringTagModel();

            model.Add(this);

            using (new TemporaryRegistration(new UnencodedValueStringTagProvider())) {
                // Custom tag models
                Assert.AreEqual("Mono & .NET", StringParserService.Parse("${UNENCODEDVALUE:HtmlEncode}", model));
                Assert.AreEqual("mono & .net", StringParserService.Parse("${UNENCODEDVALUE:lower}", model));
                Assert.AreEqual("MONO & .NET", StringParserService.Parse("${UNENCODEDVALUE:UPPER}", model));

                // Built-in string generators
                Assert.That(StringParserService.Parse("${YEAR:F4}", model), Is.StringEnding("0000"));
            }
        }
Esempio n. 3
0
 public void TestFormatDoesntExist()
 {
     Assert.AreEqual("${NON-EXISTENT TAG}", StringParserService.Parse("${NON-EXISTENT TAG}"));
 }
Esempio n. 4
0
 public void Dispose()
 {
     StringParserService.UnregisterStringTagProvider(provider);
 }
Esempio n. 5
0
 public TemporaryRegistration(IStringTagProvider provider)
 {
     this.provider = provider;
     StringParserService.RegisterStringTagProvider(provider);
 }