The StackFilter object provides a filter that can be given a collection of filters which can be used to resolve a replacement. The order of the resolution used for this filter is last in first used. This order allows the highest priority filter to be added last within the stack.
Inheritance: Filter
Exemplo n.º 1
0
 public void TestFilter() {
    List<String> list = new List<String>();
    StackFilter filter = new StackFilter();
    filter.Push(new ExampleFilter(list, "one"));
    filter.Push(new ExampleFilter(list, "two"));
    filter.Push(new ExampleFilter(list, "three"));
    String one = filter.Replace("one");
    String two = filter.Replace("two");
    String three = filter.Replace("three");
    AssertEquals(one, "one");
    AssertEquals(two, "two");
    AssertEquals(three, "three");
    AssertEquals(list.Count, 3);
    AssertEquals(list[0], "one");
    AssertEquals(list[1], "two");
    AssertEquals(list[2], "three");
 }
Exemplo n.º 2
0
        public void TestFilter()
        {
            List <String> list   = new List <String>();
            StackFilter   filter = new StackFilter();

            filter.Push(new ExampleFilter(list, "one"));
            filter.Push(new ExampleFilter(list, "two"));
            filter.Push(new ExampleFilter(list, "three"));
            String one   = filter.Replace("one");
            String two   = filter.Replace("two");
            String three = filter.Replace("three");

            AssertEquals(one, "one");
            AssertEquals(two, "two");
            AssertEquals(three, "three");
            AssertEquals(list.Count, 3);
            AssertEquals(list[0], "one");
            AssertEquals(list[1], "two");
            AssertEquals(list[2], "three");
        }