示例#1
0
 /// <summary>
 /// Validate the object.
 /// </summary>
 /// <exception cref="ValidationException">
 /// Thrown if validation fails
 /// </exception>
 public virtual void Validate()
 {
     if (RoleRef == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "RoleRef");
     }
     if (Subjects == null)
     {
         throw new ValidationException(ValidationRules.CannotBeNull, "Subjects");
     }
     if (Metadata != null)
     {
         Metadata.Validate();
     }
     if (RoleRef != null)
     {
         RoleRef.Validate();
     }
     if (Subjects != null)
     {
         foreach (var element in Subjects)
         {
             if (element != null)
             {
                 element.Validate();
             }
         }
     }
 }
示例#2
0
        public void LoadCalculationRoleRefs_07_06()
        {
            TestPresentation tp = new TestPresentation();

            tp.ProcessingPresenationType = PreseantationTypeCode.Calculation;

            int errors = 0;

            if (tp.Load(GAAP_CI_CALCULATION_FILE_07_06, out errors) == false)
            {
                Assert.Fail((string)tp.ErrorList[0]);
            }

            int numErrors = 0;

            tp.LoadRoleRefs(out numErrors);

            Assert.AreEqual(0, numErrors);
            Assert.IsNotNull(tp.roleRefs);
            Assert.AreEqual(6, tp.roleRefs.Count);

            Assert.IsTrue(tp.roleRefs.ContainsKey("http://www.xbrl.org/taxonomy/us/fr/gaap/role/TotalStockholdersEquityCalculation"));
            Assert.IsTrue(tp.roleRefs.ContainsKey("http://www.xbrl.org/taxonomy/us/fr/gaap/role/StatementStockholdersEquity"));
            Assert.IsTrue(tp.roleRefs.ContainsKey("http://www.xbrl.org/taxonomy/us/fr/gaap/role/StatementCashFlowsDirect"));
            Assert.IsTrue(tp.roleRefs.ContainsKey("http://www.xbrl.org/taxonomy/us/fr/gaap/role/StatementCashFlowsIndirect"));
            Assert.IsTrue(tp.roleRefs.ContainsKey("http://www.xbrl.org/taxonomy/us/fr/gaap/role/IncomeStatement"));
            Assert.IsTrue(tp.roleRefs.ContainsKey("http://www.xbrl.org/taxonomy/us/fr/gaap/role/StatementFinancialPosition"));

            RoleRef     rr = tp.roleRefs["http://www.xbrl.org/taxonomy/us/fr/gaap/role/TotalStockholdersEquityCalculation"] as RoleRef;
            TestRoleRef rt = new TestRoleRef(rr);

            Assert.IsNotNull(rt);
        }
示例#3
0
        public void TestAddAndMergeFileReference()
        {
            RoleRef rr = new RoleRef();

            rr.AddFileReference(null);
            Assert.IsNull(rr.GetFileReferences(), "should not have any file refs");
            rr.AddFileReference(string.Empty);
            Assert.IsNull(rr.GetFileReferences(), "should not have any file refs");

            rr.AddFileReference("a.xsd");
            Assert.AreEqual(1, rr.GetFileReferences().Count, "wrong num file refs");
            Assert.AreEqual("a.xsd", rr.GetFileReferences()[0], "wrong file ref added");
            rr.AddFileReference("b.xsd");
            Assert.AreEqual(2, rr.GetFileReferences().Count, "wrong num file refs");
            Assert.AreEqual("b.xsd", rr.GetFileReferences()[1], "wrong file ref added");
            rr.AddFileReference("b.xsd");
            Assert.AreEqual(2, rr.GetFileReferences().Count, "wrong num file refs");

            rr.MergeFileReferences(null);
            Assert.AreEqual(2, rr.GetFileReferences().Count, "wrong num file refs");
            Assert.AreEqual("a.xsd", rr.GetFileReferences()[0], "wrong file ref added");
            Assert.AreEqual("b.xsd", rr.GetFileReferences()[1], "wrong file ref added");
            rr.MergeFileReferences(new List <string>());
            Assert.AreEqual(2, rr.GetFileReferences().Count, "wrong num file refs");
            Assert.AreEqual("a.xsd", rr.GetFileReferences()[0], "wrong file ref added");
            Assert.AreEqual("b.xsd", rr.GetFileReferences()[1], "wrong file ref added");


            List <string> merge = new List <string>(rr.GetFileReferences());

            rr.MergeFileReferences(merge);
            Assert.AreEqual(2, rr.GetFileReferences().Count, "wrong num file refs");
            Assert.AreEqual("a.xsd", rr.GetFileReferences()[0], "wrong file ref added");
            Assert.AreEqual("b.xsd", rr.GetFileReferences()[1], "wrong file ref added");

            merge.Add("c.xsd");
            merge.Add("d.xsd");
            rr.MergeFileReferences(merge);
            Assert.AreEqual(4, rr.GetFileReferences().Count, "wrong num file refs");
            Assert.AreEqual("a.xsd", rr.GetFileReferences()[0], "wrong file ref added");
            Assert.AreEqual("b.xsd", rr.GetFileReferences()[1], "wrong file ref added");
            Assert.AreEqual("c.xsd", rr.GetFileReferences()[2], "wrong file ref added");
            Assert.AreEqual("d.xsd", rr.GetFileReferences()[3], "wrong file ref added");
        }
示例#4
0
        public void Test_Presentation_RoleRefs_07_06()
        {
            TestPresentation tp = new TestPresentation();

            tp.ProcessingPresenationType = PreseantationTypeCode.Presentation;

            int errors = 0;

            if (tp.Load(GAAP_PRESENTATION_FILE_07_06, out errors) == false)
            {
                Assert.Fail((string)tp.ErrorList[0]);
            }

            int numErrors = 0;

            tp.LoadRoleRefs(out numErrors);

            Assert.AreEqual(0, numErrors);
            Assert.IsNotNull(tp.roleRefs);
            Assert.AreEqual(6, tp.roleRefs.Count);

            Assert.IsTrue(tp.roleRefs.ContainsKey("http://www.xbrl.org/taxonomy/us/fr/gaap/role/Notes"));
            Assert.IsTrue(tp.roleRefs.ContainsKey("http://www.xbrl.org/taxonomy/us/fr/gaap/role/StatementStockholdersEquity"));
            Assert.IsTrue(tp.roleRefs.ContainsKey("http://www.xbrl.org/taxonomy/us/fr/gaap/role/StatementCashFlowsDirect"));
            Assert.IsTrue(tp.roleRefs.ContainsKey("http://www.xbrl.org/taxonomy/us/fr/gaap/role/StatementCashFlowsIndirect"));
            Assert.IsTrue(tp.roleRefs.ContainsKey("http://www.xbrl.org/taxonomy/us/fr/gaap/role/IncomeStatement"));
            Assert.IsTrue(tp.roleRefs.ContainsKey("http://www.xbrl.org/taxonomy/us/fr/gaap/role/StatementFinancialPosition"));

            RoleRef     rr = tp.roleRefs["http://www.xbrl.org/taxonomy/us/fr/gaap/role/StatementStockholdersEquity"] as RoleRef;
            TestRoleRef rt = new TestRoleRef(rr);

            Assert.IsNotNull(rt);

            Assert.AreEqual("http://www.xbrl.org/taxonomy/us/fr/gaap/role/StatementStockholdersEquity", rt.Uri);
            Assert.AreEqual("us-gaap-ci-2004-07-06.xsd#StatementStockholdersEquity", rt.Href);
            Assert.AreEqual("StatementStockholdersEquity", rt.GetId());
            Assert.AreEqual("us-gaap-ci-2004-07-06.xsd", rt.GetSchemaName());

            //http://www.xbrl.org/taxonomy/us/fr/gaap/role/StatementCashFlowsDirect
            rr = tp.roleRefs["http://www.xbrl.org/taxonomy/us/fr/gaap/role/StatementCashFlowsDirect"] as RoleRef;
            rt = new TestRoleRef(rr);

            Assert.IsNotNull(rt);

            Assert.AreEqual("http://www.xbrl.org/taxonomy/us/fr/gaap/role/StatementCashFlowsDirect", rt.Uri);
            Assert.AreEqual("us-gaap-ci-2004-07-06.xsd#StatementCashFlowsDirect", rt.Href);
            Assert.AreEqual("StatementCashFlowsDirect", rt.GetId());
            Assert.AreEqual("us-gaap-ci-2004-07-06.xsd", rt.GetSchemaName());

            //http://www.xbrl.org/taxonomy/us/fr/gaap/role/StatementCashFlowsIndirect
            rr = tp.roleRefs["http://www.xbrl.org/taxonomy/us/fr/gaap/role/StatementCashFlowsIndirect"] as RoleRef;
            rt = new TestRoleRef(rr);

            Assert.IsNotNull(rt);

            Assert.AreEqual("http://www.xbrl.org/taxonomy/us/fr/gaap/role/StatementCashFlowsIndirect", rt.Uri);
            Assert.AreEqual("us-gaap-ci-2004-07-06.xsd#StatementCashFlowsIndirect", rt.Href);
            Assert.AreEqual("StatementCashFlowsIndirect", rt.GetId());
            Assert.AreEqual("us-gaap-ci-2004-07-06.xsd", rt.GetSchemaName());

            //http://www.xbrl.org/taxonomy/us/fr/gaap/role/IncomeStatement
            rr = tp.roleRefs["http://www.xbrl.org/taxonomy/us/fr/gaap/role/IncomeStatement"] as RoleRef;
            rt = new TestRoleRef(rr);

            Assert.IsNotNull(rt);

            Assert.AreEqual("http://www.xbrl.org/taxonomy/us/fr/gaap/role/IncomeStatement", rt.Uri);
            Assert.AreEqual("us-gaap-ci-2004-07-06.xsd#IncomeStatement", rt.Href);
            Assert.AreEqual("IncomeStatement", rt.GetId());
            Assert.AreEqual("us-gaap-ci-2004-07-06.xsd", rt.GetSchemaName());

            //http://www.xbrl.org/taxonomy/us/fr/gaap/role/StatementFinancialPosition
            rr = tp.roleRefs["http://www.xbrl.org/taxonomy/us/fr/gaap/role/StatementFinancialPosition"] as RoleRef;
            rt = new TestRoleRef(rr);

            Assert.IsNotNull(rt);

            Assert.AreEqual("http://www.xbrl.org/taxonomy/us/fr/gaap/role/StatementFinancialPosition", rt.Uri);
            Assert.AreEqual("us-gaap-ci-2004-07-06.xsd#StatementFinancialPosition", rt.Href);
            Assert.AreEqual("StatementFinancialPosition", rt.GetId());
            Assert.AreEqual("us-gaap-ci-2004-07-06.xsd", rt.GetSchemaName());
        }
示例#5
0
 /// <exclude/>
 public TestRoleRef(RoleRef rr)
     : base(rr)
 {
 }