示例#1
0
        public void AddTwoNewImportStandard()
        {
            string projectPath        = String.Empty;
            string projectPathImport1 = String.Empty;
            string projectPathImport2 = String.Empty;

            try
            {
                Project p = new Project(new Engine());
                projectPath        = ObjectModelHelpers.CreateTempFileOnDisk(TestData.Content3SimpleTargetsDefaultSpecified);
                projectPathImport1 = ObjectModelHelpers.CreateTempFileOnDisk(TestData.Content3SimpleTargetsDefaultSpecified);
                projectPathImport2 = ObjectModelHelpers.CreateTempFileOnDisk(TestData.Content3SimpleTargetsDefaultSpecified);
                p.Load(projectPath);
                InvokeAddNewImportMethod(p, projectPathImport1, "true");
                InvokeAddNewImportMethod(p, projectPathImport2, "true");
                Assertion.AssertEquals(0, p.Imports.Count);
                object o = p.EvaluatedItems;                                                             // force evaluation of imported projects.
                Assertion.AssertEquals(2, CompatibilityTestHelpers.CountNodesWithName(p.Xml, "Import")); // 2 in the XML
                Assertion.AssertEquals(2, p.Imports.Count);                                              // 2 in OM
            }
            finally
            {
                CompatibilityTestHelpers.RemoveFile(projectPath);
                CompatibilityTestHelpers.RemoveFile(projectPathImport1);
                CompatibilityTestHelpers.RemoveFile(projectPathImport2);
            }
        }
示例#2
0
        public void AddNewImportToBecomeSelfReferentialTwice()
        {
            string projectPath = String.Empty;

            try
            {
                Project p = new Project(new Engine());
                projectPath = ObjectModelHelpers.CreateTempFileOnDisk(TestData.Content3SimpleTargetsDefaultSpecified);
                InvokeAddNewImportMethod(p, projectPath, null);
                InvokeAddNewImportMethod(p, projectPath, null);
                object o = p.EvaluatedItems;                                                             // force evaluation of imported projects.
                Assertion.AssertEquals(1, p.Imports.Count);
                Assertion.AssertEquals(2, CompatibilityTestHelpers.CountNodesWithName(p.Xml, "Import")); // 2 in the XML
            }
            finally
            {
                CompatibilityTestHelpers.RemoveFile(projectPath);
            }
        }