Exemplo n.º 1
0
 public void IsValid()
 {
     var v = new PastAttribute();
     Assert.IsTrue(v.IsValid(DateTime.Now.AddMilliseconds(-1), null));
     Assert.IsTrue(v.IsValid(new DateTime?(), null));
     Assert.IsTrue(v.IsValid(new DateTime?(DateTime.Now.AddDays(-1)), null));
     Assert.IsTrue(v.IsValid(null, null));
     Assert.IsTrue(v.IsValid(new DateTime(), null));
     Assert.IsFalse(v.IsValid(DateTime.Now, null));
     Assert.IsFalse(v.IsValid(DateTime.Now.AddMilliseconds(+1), null));
     Assert.IsFalse(v.IsValid(DateTime.Now.ToString(), null));
     Assert.IsFalse(v.IsValid(123456, null));
 }
Exemplo n.º 2
0
        private static Attribute ConvertToPast(XmlNhvmRuleConverterArgs rule)
        {
            NhvmPast pastRule = (NhvmPast)rule.schemaRule;
            log.Info("Converting to Past attribute");
            PastAttribute thisAttribute = new PastAttribute();
            if (pastRule.message != null)
            {
                thisAttribute.Message = pastRule.message;
            }
            AssignTagsFromString(thisAttribute, pastRule.tags);

            return thisAttribute;
        }