예제 #1
0
        public virtual void TestThreadSafety()
        {
            CodeResolverRegistry.RegisterCodeResolverRegistryForVersion(SpecificationVersion.R02_04_02, registry1);
            CodeResolverRegistry.RegisterCodeResolverRegistryForVersion(SpecificationVersion.R02_04_03, registry2);
            CodeResolverRegistry.RegisterCodeResolverRegistryForVersion(SpecificationVersion.R02_04_03_AB, registry3);
            CodeResolverRegistry.RegisterCodeResolverRegistryForVersion(SpecificationVersion.V01R04_2_SK, registry4);
            CodeResolverRegistry.RegisterCodeResolverRegistryForVersion(SpecificationVersion.V01R04_3, registry5);
            CodeResolverRegistry.RegisterCodeResolverRegistryForVersion(SpecificationVersion.V01R04_3_ON, registry6);
            IList <CodeResolverRegistryTest.ThreadTest> testList = new List <CodeResolverRegistryTest.ThreadTest>();

            for (int i = 0; i < 100; i++)
            {
                testList.Add(new CodeResolverRegistryTest.ThreadTest(this, i * 6, SpecificationVersion.R02_04_02, registry1));
                testList.Add(new CodeResolverRegistryTest.ThreadTest(this, i * 6 + 1, SpecificationVersion.R02_04_03, registry2));
                testList.Add(new CodeResolverRegistryTest.ThreadTest(this, i * 6 + 2, SpecificationVersion.R02_04_03_AB, registry3));
                testList.Add(new CodeResolverRegistryTest.ThreadTest(this, i * 6 + 3, SpecificationVersion.V01R04_2_SK, registry4));
                testList.Add(new CodeResolverRegistryTest.ThreadTest(this, i * 6 + 4, SpecificationVersion.V01R04_3, registry5));
                testList.Add(new CodeResolverRegistryTest.ThreadTest(this, i * 6 + 5, SpecificationVersion.V01R04_3_ON, registry6));
            }
            foreach (CodeResolverRegistryTest.ThreadTest threadTest in testList)
            {
                threadTest.Start();
            }
            foreach (CodeResolverRegistryTest.ThreadTest threadTest in testList)
            {
                threadTest.Join();
            }
            foreach (CodeResolverRegistryTest.ThreadTest threadTest in testList)
            {
                // "thread " + threadTest.GetThreadId(),
                NUnit.Framework.Assert.IsTrue(threadTest.HasPassedTest());
            }
        }
예제 #2
0
 public virtual void TestRegistryRegistration()
 {
     CodeResolverRegistry.RegisterCodeResolverRegistryForVersion(SpecificationVersion.R02_04_02, registry1);
     CodeResolverRegistry.RegisterCodeResolverRegistryForVersion(SpecificationVersion.R02_04_03, registry2);
     CodeResolverRegistry.RegisterCodeResolverRegistryForVersion(SpecificationVersion.R02_04_03_AB, registry3);
     NUnit.Framework.Assert.AreEqual(registry1, CodeResolverRegistry.GetCodeResolverRegistryForVersion(SpecificationVersion.R02_04_02));
     NUnit.Framework.Assert.AreEqual(registry2, CodeResolverRegistry.GetCodeResolverRegistryForVersion(SpecificationVersion.R02_04_03));
     NUnit.Framework.Assert.AreEqual(registry3, CodeResolverRegistry.GetCodeResolverRegistryForVersion(SpecificationVersion.R02_04_03_AB));
     NUnit.Framework.Assert.IsNull(CodeResolverRegistry.GetCodeResolverRegistryForVersion(SpecificationVersion.V01R04_3));
 }
예제 #3
0
 public virtual void TestRegistryRetrieval()
 {
     CodeResolverRegistry.RegisterCodeResolverRegistryForVersion(SpecificationVersion.R02_04_02, registry1);
     CodeResolverRegistry.RegisterCodeResolverRegistryForVersion(SpecificationVersion.R02_04_03, registry2);
     CodeResolverRegistry.RegisterCodeResolverRegistryForVersion(SpecificationVersion.R02_04_03_AB, registry3);
     CodeResolverRegistry.SetThreadLocalVersion(SpecificationVersion.R02_04_02);
     NUnit.Framework.Assert.AreEqual(registry1, CodeResolverRegistry.GetRegistry());
     CodeResolverRegistry.SetThreadLocalVersion(SpecificationVersion.R02_04_03);
     NUnit.Framework.Assert.AreEqual(registry2, CodeResolverRegistry.GetRegistry());
     CodeResolverRegistry.SetThreadLocalVersion(SpecificationVersion.R02_04_03_AB);
     NUnit.Framework.Assert.AreEqual(registry3, CodeResolverRegistry.GetRegistry());
     CodeResolverRegistry.ClearThreadLocalVersion();
     NUnit.Framework.Assert.AreEqual(CodeResolverRegistry.GetDefaultRegistry(), CodeResolverRegistry.GetRegistry());
 }