Пример #1
0
 public void IfExistsRecycle()
 {
     var xml = new XmlSample(@"<Move Destination='somewhere' IfExists='recycle' />");
     using (var reader = xml.Read())
     {
         var rule = ConfigFileReader.ReadRule(reader, false) as MoveRule;
         Assert.AreEqual(MoveRule.IfExistsMode.Recycle, rule.IfExists);
     }
 }
Пример #2
0
 public void DestinationAttribute()
 {
     var xml = new XmlSample(@"<Move Destination='somewhere' />");
     using (var reader = xml.Read())
     {
         var rule = ConfigFileReader.ReadRule(reader, false) as MoveRule ;
         Assert.AreEqual("somewhere", rule.Destination);
     }
 }
Пример #3
0
 public void ValidElement()
 {
     var xml = new XmlSample(@"<Empty />");
     using( var reader = xml.Read() )
     {
         var filter = ConfigFileReader.ReadFilter(reader);
         Assert.IsInstanceOf<EmptyFilter>(filter);
     }
 }
Пример #4
0
 public void AttributeMissing()
 {
     var xml = new XmlSample(@"<Move />");
     using (var reader = xml.Read())
     {
         Assert.Throws<AttributeMissingException>(() =>
         {
             ConfigFileReader.ReadRule(reader, false);
         });
     }
 }
Пример #5
0
 public void AttributeMissing()
 {
     var xml = new XmlSample(@"<BiggerThan />");
     using (var reader = xml.Read())
     {
         Assert.Throws<AttributeMissingException>(() =>
         {
             ConfigFileReader.ReadFilter(reader);
         });
     }
 }
Пример #6
0
        public void Mega()
        {
            var xml = new XmlSample(@"<BiggerThan MB='10' />");
            using (var reader = xml.Read())
            {
                var filter = ConfigFileReader.ReadFilter(reader);
                Assert.IsInstanceOf<BiggerThanFilter>(filter);

                var size = ((BiggerThanFilter)filter).Size;
                Assert.AreEqual(10 * 1024 * 1024, size);
            }
        }