public void Test_FromXml_MissingPeriod() { TestContextProperty tcp = new TestContextProperty(); tcp.ContextID = "current_ForPeriod"; tcp.EntitySchema = "http://www.aucent.com/test"; //tcp.EntityValue = "Aucent Corporation"; // tcp.PeriodStartDate = new DateTime( 2004, 1, 15 ); // tcp.PeriodEndDate = new DateTime( 2004, 7, 31 ); tcp.PeriodType = Element.PeriodType.duration; tcp.Scenarios.Add(new Scenario("name", "MA", "residence", "fid", "http://www.someInsuranceCo.com/scenarios")); tcp.Scenarios.Add(new Scenario("name2", "true", "nonSmoker", "fid", "http://www.someInsuranceCo.com/scenarios")); tcp.Scenarios.Add(new Scenario("name3", "34", "minAge", "fid", "http://www.someInsuranceCo.com/scenarios")); tcp.Scenarios.Add(new Scenario("name4", "49", "maxAge", "fid", "http://www.someInsuranceCo.com/scenarios")); XmlDocument doc = new XmlDocument(); XmlElement root = doc.CreateElement("root"); doc.AppendChild(root); XmlElement elem = tcp.Append(doc, root, null); XmlNamespaceManager theManager = new XmlNamespaceManager(doc.NameTable); theManager.AddNamespace("link2", "http://www.xbrl.org/2003/instance"); ArrayList errors = null; ContextProperty cpBack = null; Assert.IsFalse(ContextProperty.TryCreateFromXml(elem, theManager, out cpBack, ref errors), errors.Count > 0 ? ((ParserMessage)errors[0]).Message : string.Empty); }
public void Test_FromXml_CreateCurrentForPeriod() { TestContextProperty tcp = new TestContextProperty(); tcp.ContextID = "current_ForPeriod"; tcp.EntitySchema = "http://www.aucent.com/test"; tcp.EntityValue = "Aucent Corporation"; tcp.PeriodStartDate = new DateTime(2004, 1, 15); tcp.PeriodEndDate = new DateTime(2004, 7, 31); tcp.PeriodType = Element.PeriodType.duration; XmlDocument doc = new XmlDocument(); XmlElement root = doc.CreateElement("root"); doc.AppendChild(root); XmlElement elem = tcp.Append(doc, root, null); XmlNamespaceManager theManager = new XmlNamespaceManager(doc.NameTable); theManager.AddNamespace("link2", "http://www.xbrl.org/2003/instance"); ArrayList errors = null; ContextProperty cpBack = null; Assert.IsTrue(ContextProperty.TryCreateFromXml(elem, theManager, out cpBack, ref errors), errors.Count > 0 ? ((ParserMessage)errors[0]).Message : string.Empty); Assert.IsTrue(tcp.ValueEquals(cpBack), "objects don't match"); }