示例#1
0
        public void Test_FromXml_CreateCurrentForPeriod_WithScenario()
        {
            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.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");
        }
示例#2
0
        public void Test_FromXml_CurrentAsOf()
        {
            TestContextProperty tcp = new TestContextProperty();

            tcp.ContextID       = "current_AsOf";
            tcp.EntitySchema    = "http://www.aucent.com/test";
            tcp.EntityValue     = "Aucent Corporation";
            tcp.PeriodStartDate = new DateTime(2004, 7, 9);
            tcp.PeriodType      = Element.PeriodType.instant;

            XmlDocument doc  = new XmlDocument();
            XmlElement  root = doc.CreateElement("root");

            doc.AppendChild(root);

            XmlElement          cpXml      = 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(cpXml, theManager, out cpBack, ref errors), errors.Count > 0 ? ((ParserMessage)errors[0]).Message : string.Empty);

            Assert.IsTrue(tcp.ValueEquals(cpBack), "objects don't match");
        }
示例#3
0
        public void Test_FromXml_WithScenarioAndSegment()
        {
            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" ) );

            tcp.Segments.Add( new Segment( "name", "MI", "stateProvince", "my", "http://www.someCompany.com/segment" ) );
            tcp.Segments.Add( new Segment( "name", "CO", "stateProvince", "my", "http://www.someCompany.com/segment" ) );
            tcp.Segments.Add( new Segment( "name", "AL", "stateProvince", "my", "http://www.someCompany.com/segment" ) );
            tcp.Segments.Add( new Segment( "name", "AK", "stateProvince", "my", "http://www.someCompany.com/segment" ) );

            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" );
        }
示例#4
0
        public void Test_FromXml_CurrentAsOf()
        {
            TestContextProperty tcp = new TestContextProperty();

            tcp.ContextID = "current_AsOf";
            tcp.EntitySchema = "http://www.aucent.com/test";
            tcp.EntityValue = "Aucent Corporation";
            tcp.PeriodStartDate = new DateTime( 2004, 7, 9 );
            tcp.PeriodType = Element.PeriodType.instant;

            XmlDocument doc = new XmlDocument();
            XmlElement root = doc.CreateElement( "root" );
            doc.AppendChild( root );

            XmlElement cpXml = 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( cpXml, theManager, out cpBack, ref errors  ), errors.Count > 0 ? ((ParserMessage)errors[0]).Message : string.Empty );

            Assert.IsTrue( tcp.ValueEquals( cpBack ), "objects don't match" );
        }