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)); }
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; }