コード例 #1
0
    private static int Main()
    {
#if !MULTIMODULE_BUILD
        TestLdstr.Run();
        TestException.Run();
        TestThreadStaticNotInitialized.Run();
        TestUntouchedThreadStaticInitialized.Run();
        TestPointers.Run();
        TestConstants.Run();
        TestArray.Run();
        TestMdArray.Run();
        TestSimpleObject.Run();
        TestFinalizableObject.Run();
        TestStoreIntoOtherStatic.Run();
        TestCctorCycle.Run();
        TestReferenceTypeAllocation.Run();
        TestReferenceTypeWithGCPointerAllocation.Run();
        TestRelationalOperators.Run();
        TestTryFinally.Run();
        TestTryCatch.Run();
        TestBadClass.Run();
        TestRefs.Run();
        TestDelegate.Run();
        TestInitFromOtherClass.Run();
        TestInitFromOtherClassDouble.Run();
        TestDelegateToOtherClass.Run();
#else
        Console.WriteLine("Preinitialization is disabled in multimodule builds for now. Skipping test.");
#endif

        return(100);
    }
コード例 #2
0
    private static int Main()
    {
#if !MULTIMODULE_BUILD
        TestLdstr.Run();
        TestException.Run();
        TestThreadStaticNotInitialized.Run();
        TestUntouchedThreadStaticInitialized.Run();
        TestPointers.Run();
        TestConstants.Run();
        TestArray.Run();
        TestArrayOutOfRange.Run();
        TestMdArray.Run();
        TestSimpleObject.Run();
        TestFinalizableObject.Run();
        TestStoreIntoOtherStatic.Run();
        TestCctorCycle.Run();
        TestReferenceTypeAllocation.Run();
        TestReferenceTypeWithGCPointerAllocation.Run();
        TestReferenceTypeWithReadonlyNullGCPointerAllocation.Run();
        TestRelationalOperators.Run();
        TestTryFinally.Run();
        TestTryCatch.Run();
        TestBadClass.Run();
        TestRefs.Run();
        TestDelegate.Run();
        TestInitFromOtherClass.Run();
        TestInitFromOtherClassDouble.Run();
        TestDelegateToOtherClass.Run();
        TestLotsOfBackwardsBranches.Run();
        TestDrawCircle.Run();
        TestValueTypeDup.Run();
        TestFunctionPointers.Run();
        TestGCInteraction.Run();
        TestDuplicatedFields.Run();
        TestInstanceDelegate.Run();
#else
        Console.WriteLine("Preinitialization is disabled in multimodule builds for now. Skipping test.");
#endif

        return(100);
    }
コード例 #3
0
        private void CommonSetup()
        {
            try
            {
                _namespaceMgr = new XmlNamespaceManager(_testCaseDoc.NameTable);
                _namespaceMgr.AddNamespace("SsisUnit", "http://tempuri.org/SsisUnit.xsd");

                var xmlPackageReferences = _testCaseDoc.SelectNodes("SsisUnit:TestSuite/SsisUnit:PackageList/SsisUnit:Package", _namespaceMgr);

                if (xmlPackageReferences != null)
                {
                    foreach (XmlNode pkgRef in xmlPackageReferences)
                    {
                        if (pkgRef.Attributes == null)
                        {
                            continue;
                        }

                        PackageList.Add(pkgRef.Attributes["name"].Value, new PackageRef(pkgRef));
                    }
                }

                ConnectionList = _testCaseDoc.DocumentElement != null?LoadConnectionRefs(_testCaseDoc.DocumentElement["ConnectionList"]) : new Dictionary <string, ConnectionRef>();

                var xmlDatasets = _testCaseDoc.SelectNodes("SsisUnit:TestSuite/SsisUnit:DatasetList/SsisUnit:Dataset", _namespaceMgr);

                if (xmlDatasets != null)
                {
                    foreach (XmlNode xmlDataset in xmlDatasets)
                    {
                        if (xmlDataset.Attributes == null)
                        {
                            continue;
                        }

                        Datasets.Add(xmlDataset.Attributes["name"].Value, new Dataset(this, xmlDataset));
                    }
                }

                TestSuiteSetup    = _testCaseDoc.DocumentElement != null ? new CommandSet("Test Suite Setup", this, _testCaseDoc.DocumentElement["TestSuiteSetup"]) : new CommandSet(this);
                TestSuiteTeardown = _testCaseDoc.DocumentElement != null ? new CommandSet("Test Suite Teardown", this, _testCaseDoc.DocumentElement["TestSuiteTeardown"]) : new CommandSet(this);
                SetupCommands     = _testCaseDoc.DocumentElement != null ? new CommandSet("Unit Test Setup", this, _testCaseDoc.DocumentElement["Setup"]) : new CommandSet(this);
                TeardownCommands  = _testCaseDoc.DocumentElement != null ? new CommandSet("Unit Test Teardown", this, _testCaseDoc.DocumentElement["Teardown"]) : new CommandSet(this);

                var xmlTests = _testCaseDoc.SelectNodes("SsisUnit:TestSuite/SsisUnit:Tests/SsisUnit:Test", _namespaceMgr);

                if (xmlTests != null)
                {
                    foreach (XmlNode test in xmlTests)
                    {
                        if (test.Attributes == null)
                        {
                            continue;
                        }

                        Test newTest = new Test(this, test);

                        newTest.CommandCompleted += OnRaiseCommandCompleted;
                        newTest.CommandFailed    += OnRaiseCommandFailed;
                        newTest.CommandStarted   += OnRaiseCommandStarted;

                        Tests.Add(test.Attributes["name"].Value, newTest);
                    }
                }

                var xmlTestReferences = _testCaseDoc.SelectNodes("SsisUnit:TestSuite/SsisUnit:Tests/SsisUnit:TestRef", _namespaceMgr);

                if (xmlTestReferences != null)
                {
                    foreach (XmlNode testRef in xmlTestReferences)
                    {
                        if (testRef.Attributes == null)
                        {
                            continue;
                        }

                        TestRefs.Add(testRef.Attributes["path"].Value, new TestRef(this, testRef));
                    }
                }
            }
            catch (Exception ex)
            {
                throw new ApplicationException(string.Format("The unit test file is malformed or corrupt. Please verify that the file format conforms to the ssisUnit schema, provided in the SsisUnit.xsd file."), ex);
            }
        }