예제 #1
0
        public void RemovesSetThatDoesntExist_noCrash()
        {
            Inventor.Application app = ApplicationShim.Instance();
            var      path            = app.DesignProjectManager.ActiveDesignProject.TemplatesPath;
            Document doc             = app.Documents.Add(DocumentTypeEnum.kPartDocumentObject, path + "Standard.ipt", true);

            //try to remove an attributeSet that does not exist.  Will this crash?
            AttributeShim.RemoveAttributeSet(doc, "testSet");


            bool result = false;

            foreach (AttributeSet i in doc.AttributeSets)
            {
                if (i.Name.Equals("testSet"))
                {
                    result = true;
                }
            }
            try
            {
                Assert.IsFalse(result);
            }
            finally { doc.Close(true); }
        }
예제 #2
0
        public void RemovesSetThatExists()
        {
            var doc = tests.TestUtilities.CreatePartDocument();

            //create the test AttributeSet
            AttributeSet attributeSet = doc.AttributeSets.Add("testSet");

            AttributeShim.RemoveAttributeSet(doc, "testSet");

            bool result = false;

            foreach (AttributeSet i in doc.AttributeSets)
            {
                if (i.Name.Equals("testSet"))
                {
                    result = true;
                }
            }

            try
            {
                Assert.IsFalse(result);
            }
            finally { doc.Close(true); }
        }
예제 #3
0
        public void RemovesSetThatDoesntExist_noCrash()
        {
            var doc = tests.TestUtilities.CreatePartDocument();

            //try to remove an attributeSet that does not exist.  Will this crash?
            AttributeShim.RemoveAttributeSet(doc, "testSet");

            bool result = false;

            foreach (AttributeSet i in doc.AttributeSets)
            {
                if (i.Name.Equals("testSet"))
                {
                    result = true;
                }
            }
            try
            {
                Assert.IsFalse(result);
            }
            finally { doc.Close(true); }
        }