コード例 #1
0
        public void Test_NoIdForElementValidation()
        {
            TestTaxonomy_Common s = new TestTaxonomy_Common();

            s.Load( NO_ID );
            Assert.AreEqual( Taxonomy.ValidationStatus.WARNING, s.Validate() );
        }
コード例 #2
0
        public void Test_DupIdBug()
        {
            TestTaxonomy_Common s = new TestTaxonomy_Common();

            s.Load( DUP_ID );

            int errors = 0;
            s.Parse( out errors );

            Assert.AreEqual( 0, errors, "wrong number of parse errors returned" );

            s.CurrentLabelRole = "preferredLabel";
            s.CurrentLanguage = "en";

            ArrayList nodes = s.GetNodesByPresentation();

            Assert.AreEqual( 2, nodes.Count, "wrong number of top level nodes" );

            Node firstEntry = (Node)nodes[0];
            Assert.IsNotNull( firstEntry, "firstEntry is null" );

            Node secondEntry = (Node)nodes[1];
            Assert.IsNotNull( secondEntry, "secondEntry is null" );

            Assert.AreEqual( 1, firstEntry.Children.Count, "firstEntry has the wrong number of nodes" );
            Assert.AreEqual( 1, secondEntry.Children.Count, "secondEntry has the wrong number of nodes" );

            Node firstChild = (Node)firstEntry.Children[0];
            Assert.IsNotNull( firstChild, "firstChild is null" );

            Node secondChild = (Node)secondEntry.Children[0];
            Assert.IsNotNull( secondChild, "secondChild is null" );

            // ok, here we go
            Assert.AreEqual( firstChild.MyElement, secondChild.MyElement, "elements are not equal" );
        }
コード例 #3
0
        public void Test_LanguageParse()
        {
            TestTaxonomy_Common s = new TestTaxonomy_Common();

            string uiLang = "en";

            s.CurrentLanguage = string.Empty;
            s.CurrentLanguage = uiLang;

            Assert.AreEqual( "en", s.CurrentLanguage, "wrong language info returned" );
        }
コード例 #4
0
        /// <exclude/>
        public void RunPerformanceTest(string[] Taxonomies)
        {
            #region Comments - Please Review;
            //
            //  The performance test was run in N-Unit testing facility and the PerfMon (windows performance monitor)
            //   was used to observe and note the memory usage for the nunit process.
            //   Each cycle of the loop within this method does sleep for 5 seconds (feel free to change) to allow for observation
            //   and notation of the memory size.  After each loop, the memory was cited and @ the end the bytes converted to
            //   mega-byte amounts to get the results as noted below.
            //
            //   Here is what each set of tested taxonomies included and what each part means:
            //		o Core : All linkbases except Calculation and Reference
            //		o Calc : Core plus Calculation linkbase
            //		o Full : Calc plus References linkbase
            //
            // Here are the system specs for which the results were achieved on:
            //
            // System Information:_____________________________________________________________________________________
            //     Operating System: Windows XP Professional (5.1, Build 2600) Service Pack 1 (2600.xpsp2.040919-1003)
            //             Language: English (Regional Setting: English)
            //  System Manufacturer: IBM
            //         System Model: 23739FU
            //                 BIOS: Phoenix FirstBIOS(tm) Notebook Pro Version 2.0 for IBM ThinkPad
            //            Processor: Intel(R) Pentium(R) M processor 1700MHz, ~1.7GHz
            //               Memory: 766MB RAM
            //            Page File: 357MB used, 1518MB available
            //          Windows Dir: C:\WINDOWS
            //     .Net CLR Version: 1.1.4322.2032
            // Number of Processors: 1
            //
            //	Results:______________________________
            //	 Canadian GAAP-CI:____________________
            //					Core: 25 MB
            //					Calc: 49 MB (+24 MB)
            //					Full: 81 MB (+32 MB)
            //	 IFRS:________________________________
            //					Core: 205 MB
            //					Calc: 340 MB (+135 MB)
            //					Full: 384 MB (+44  MB)
            //	____________________________________________________________________
            //	Results date: 18 Feb. 2005 (Dragon Tag Version 1.1 - in Development)
            //
            #endregion

            Console.WriteLine("================ INITIALIZING =================");
            System.Threading.Thread.Sleep(5000);

            foreach (string taxonomy in Taxonomies)
            {
                Console.WriteLine(System.Environment.NewLine);
                Console.WriteLine("===============================================");

                // Start Timer;
                DateTime TestStart	= new DateTime();
                DateTime TestEnd 	= new DateTime();
                TestStart			= DateTime.Now;

                DateTime TaskStart	= new DateTime();
                DateTime TaskEnd 	= new DateTime();
                TaskStart			= DateTime.Now;

                Console.WriteLine("-- Taxonomy: " + taxonomy );
                Console.WriteLine("-- Taxonomy Test Start Time: " + TestStart.ToString());

                TestTaxonomy_Common tx = null;
                TaskStart = DateTime.Now;
                tx = new TestTaxonomy_Common();
                TaskEnd = DateTime.Now;
                Console.WriteLine("---- Taxonomy Instantiation took: " + (TaskEnd-TaskStart).ToString());

                TaskStart = DateTime.Now;
                tx.Load(taxonomy);
                TaskEnd = DateTime.Now;
                Console.WriteLine("---- Taxonomy Loading took: " + (TaskEnd-TaskStart).ToString());

                int errors = 0;
                TaskStart = DateTime.Now;
                tx.Parse( out errors );
                TaskEnd = DateTime.Now;

                Console.WriteLine("-- Taxonomy Parsing took: " + (TaskEnd-TaskStart).ToString());

                TestEnd = DateTime.Now;
                Console.WriteLine("-- Test End Time: " + TestEnd.ToString());
                Console.WriteLine("-- Test Total Time: " + (TestEnd-TestStart).ToString());

                Console.WriteLine("===============================================");

                System.Threading.Thread.Sleep(5000);
            }
            Console.WriteLine("================ COMPLETED =================");
        }