Пример #1
0
 public void TestReplaceFirst()
 {
     Assert.Null(StandardFilters.ReplaceFirst(null, "a", "b"));
     Assert.AreEqual("", StandardFilters.ReplaceFirst("", "a", "b"));
     Assert.AreEqual("a a a a", StandardFilters.ReplaceFirst("a a a a", null, "b"));
     Assert.AreEqual("a a a a", StandardFilters.ReplaceFirst("a a a a", "", "b"));
     Assert.AreEqual("b a a a", StandardFilters.ReplaceFirst("a a a a", "a", "b"));
     Helper.AssertTemplateResult("b a a a", "{{ 'a a a a' | replace_first: 'a', 'b' }}");
 }
Пример #2
0
 public void TestReplace()
 {
     Assert.AreEqual("b b b b", StandardFilters.Replace("a a a a", "a", "b"));
     Assert.AreEqual("b a a a", StandardFilters.ReplaceFirst("a a a a", "a", "b"));
     Helper.AssertTemplateResult("b a a a", "<< 'a a a a' | replace_first: 'a', 'b' >>");
 }