Ejemplo n.º 1
0
    public void AddChild(TextMatchFilter filter)
    {
      if (child != null)
        throw new InvalidFilterException("only one child allowed");

      child = filter;
    }
Ejemplo n.º 2
0
    public void AddChild(TextMatchFilter filter)
    {
      if (children.Any(e => e.GetType() == typeof(IsNotDefinedFilter)))
        throw new InvalidFilterException("IsNotDefinedFilter cannot have siblings");
      if (children.Any(e => e.GetType() == typeof(TimeRangeFilter)))
        throw new InvalidFilterException("Children already contains TimeRangeFilter");
      if (children.Any(e => e.GetType() == typeof(TextMatchFilter)))
        throw new InvalidFilterException("Children already contains TextMatchFilter");

      children.Add(filter);
    }
Ejemplo n.º 3
0
    public void TestTextMatchFilter()
    {
      var uut = new TextMatchFilter("foobar", "colfoo", YesNo.yes);
      var xmlDoc = new XmlDocument();
      xmlDoc.LoadXml(AddNamespace(uut.ToXml()));

      Assert.AreEqual(1, xmlDoc.GetElementsByTagName("C:text-match").Count);
      var element = xmlDoc.GetElementsByTagName("C:text-match")[0];
      Assert.AreEqual("foobar", element.InnerText);
      Assert.AreEqual("colfoo", element.Attributes["collation"].Value);
      Assert.AreEqual("yes", element.Attributes["negate-condition"].Value);
    }