public void RemovesNonExisting_noCrash() { var doc = tests.TestUtilities.CreatePartDocument(); //create the test AttributeSet AttributeSet attributeSet = doc.AttributeSets.Add("testSet"); // Inventor.Attribute attribute = attributeSet.Add("testAttribute", ValueTypeEnum.kStringType, "test string"); AttributeShim.RemoveAttribute(doc, "testSet", "testAttribute"); bool result = false; foreach (Inventor.Attribute i in doc.AttributeSets["testSet"]) { if (i.Name.Equals("testAttribute")) { result = true; } } try { Assert.IsFalse(result); } finally { doc.Close(true); } }
public void CreateSetThatExists_noCrash() { var doc = tests.TestUtilities.CreatePartDocument(); //create the test AttributeSet AttributeSet attributeSet = doc.AttributeSets.Add("testSet"); AttributeShim.CreateAttributeSet(doc, "testSet"); bool result = false; foreach (AttributeSet i in doc.AttributeSets) { if (i.Name.Equals("testSet")) { result = true; } } try { Assert.IsTrue(result); } finally { doc.Close(true); } }
public void returnsTrue() { var doc = tests.TestUtilities.CreatePartDocument(); var result = AttributeShim.ObjectIsAttributeCapable(doc); try { Assert.IsTrue(result); } finally { doc.Close(true); } }
public void DoesNotExist_returnsFalse() { var doc = tests.TestUtilities.CreatePartDocument(); var result = AttributeShim.AttributeSetExists(doc, "testSet"); try { Assert.IsFalse(result); } finally { doc.Close(true); } }
public void returnsFalse() { Inventor.Application app = ApplicationShim.Instance(); //Application object is not attribute capable. var result = AttributeShim.ObjectIsAttributeCapable(app); try { Assert.IsFalse(result); } finally { } }
public void DoesNotExist_returnsFalse() { Inventor.Application app = ApplicationShim.Instance(); var path = app.DesignProjectManager.ActiveDesignProject.TemplatesPath; Document doc = app.Documents.Add(DocumentTypeEnum.kPartDocumentObject, path + "Standard.ipt", true); var result = AttributeShim.AttributeSetExists(doc, "testSet"); try { Assert.IsFalse(result); } finally { doc.Close(true); } }
public void DoesExist_returnsTrue() { var doc = tests.TestUtilities.CreatePartDocument(); //create the test attribute AttributeSet attributeSet = doc.AttributeSets.Add("testSet"); var result = AttributeShim.AttributeSetExists(doc, "testSet"); try { Assert.IsTrue(result); } finally { doc.Close(true); } }
public void returnsTrue() { Inventor.Application app = ApplicationShim.Instance(); var path = app.DesignProjectManager.ActiveDesignProject.TemplatesPath; //Document object is attribute capable. Document doc = app.Documents.Add(DocumentTypeEnum.kPartDocumentObject, path + "Standard.ipt", true); var result = AttributeShim.ObjectIsAttributeCapable(doc); try { Assert.IsTrue(result); } finally { doc.Close(true); } }
public void Double_SetNew() { var doc = tests.TestUtilities.CreatePartDocument(); //create the test Attribute double test = 16.00; AttributeShim.SetAttributeValue(doc, "testSet", "testAttribute", test); var result = doc.AttributeSets["testSet"]["testAttribute"].Value; try { Assert.AreEqual(result, test); } finally { doc.Close(true); } }
public void AttDoesExist_returnsTrue() { var doc = tests.TestUtilities.CreatePartDocument(); //create the test attribute AttributeSet attributeSet = doc.AttributeSets.Add("testSet"); Attribute _ = attributeSet.Add("testAttribute", ValueTypeEnum.kStringType, "test string"); var result = AttributeShim.AttributeExists(doc, "testSet", "testAttribute"); try { Assert.IsTrue(result); } finally { doc.Close(true); } }
public void Integer_SetExisting() { var doc = tests.TestUtilities.CreatePartDocument(); //create the test Attribute var test = 16; AttributeShim.SetAttributeValue(doc, "testSet", "testAttribute", 19); AttributeShim.SetAttributeValue(doc, "testSet", "testAttribute", test); var result = doc.AttributeSets["testSet"]["testAttribute"].Value; try { Assert.AreEqual(result, test); } finally { doc.Close(true); } }
public void Bool_SetNew() { Inventor.Application app = ApplicationShim.Instance(); var path = app.DesignProjectManager.ActiveDesignProject.TemplatesPath; Document doc = app.Documents.Add(DocumentTypeEnum.kPartDocumentObject, path + "Standard.ipt", true); //create the test Attribute var test = true; AttributeShim.SetAttributeValue(doc, "testSet", "testAttribute", test); var result = doc.AttributeSets["testSet"]["testAttribute"].Value; try { Assert.AreEqual(1, result); } finally { doc.Close(true); } }
public void GetExisting_works() { var doc = tests.TestUtilities.CreatePartDocument(); //create the test Attribute var test = "test string"; AttributeSet attributeSet = doc.AttributeSets.Add("testSet"); Inventor.Attribute attribute = attributeSet.Add("testAttribute", ValueTypeEnum.kStringType, test); var result = AttributeShim.GetAttributeValue(doc, "testSet", "testAttribute"); try { Assert.AreEqual(result, test); } finally { doc.Close(true); } }
public void DoesExist_returnsTrue() { Inventor.Application app = ApplicationShim.Instance(); var path = app.DesignProjectManager.ActiveDesignProject.TemplatesPath; Document doc = app.Documents.Add(DocumentTypeEnum.kPartDocumentObject, path + "Standard.ipt", true); //create the test attribute AttributeSet attributeSet = doc.AttributeSets.Add("testSet"); Attribute _ = attributeSet.Add("testAttribute", ValueTypeEnum.kStringType, "test string"); var result = AttributeShim.AttributeExists(doc, "testSet", "testAttribute"); try { Assert.IsTrue(result); } finally { doc.Close(true); } }
public void CreateSetThatDoesntExist() { var doc = tests.TestUtilities.CreatePartDocument(); //try to remove an attributeSet that does not exist. Will this crash? AttributeShim.CreateAttributeSet(doc, "testSet"); bool result = false; foreach (AttributeSet i in doc.AttributeSets) { if (i.Name.Equals("testSet")) { result = true; } } try { Assert.IsTrue(result); } finally { doc.Close(true); } }
public void GetExisting_works() { Inventor.Application app = ApplicationShim.Instance(); var path = app.DesignProjectManager.ActiveDesignProject.TemplatesPath; Document doc = app.Documents.Add(DocumentTypeEnum.kPartDocumentObject, path + "Standard.ipt", true); //create the test Attribute var test = "test string"; AttributeSet attributeSet = doc.AttributeSets.Add("testSet"); Inventor.Attribute attribute = attributeSet.Add("testAttribute", ValueTypeEnum.kStringType, test); var result = AttributeShim.GetAttributeValue(doc, "testSet", "testAttribute"); try { Assert.AreEqual(result, test); } finally { doc.Close(true); } }