public void BadInput_Empty() { Inventor.Application app = ApplicationShim.Instance(); var test = string.Empty; Assert.IsFalse(PathShim.IsContentCenterPath(test, ref app)); }
public void GoodInput() { Inventor.Application app = ApplicationShim.Instance(); var designProject = app.DesignProjectManager.ActiveDesignProject; var libraryPaths = designProject.LibraryPaths; var i = libraryPaths.Count + 1; libraryPaths.Add("temporary path", @"C:\"); string test = libraryPaths[1].Path; test = PathShim.TrimEndingDirectorySeparator(test); try { Assert.IsTrue(test.IsLibraryPath(app)); } finally { libraryPaths[i].Delete(); Marshal.ReleaseComObject(app); app = null; } }
internal static Inventor.Document CreatePartDocument() { Inventor.Application app = ApplicationShim.Instance(); var path = app.DesignProjectManager.ActiveDesignProject.TemplatesPath; return(app.Documents.Add(DocumentTypeEnum.kPartDocumentObject, path + "Standard.ipt", true)); }
public void CreateSetThatDoesntExist() { 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.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 RemovesNonExisting_noCrash() { 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 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 static string WorkspacePath() { Inventor.Application app = ApplicationShim.Instance(); var path = app.DesignProjectManager.ActiveDesignProject.WorkspacePath; return(path); }
public void BadInput_Wrong() { Inventor.Application app = ApplicationShim.Instance(); string test = @"C:\Windows\"; Assert.IsFalse(PathShim.IsContentCenterPath(test, ref app)); }
public void PartDocument_IsReturned() { Inventor.Application app = ApplicationShim.Instance(); var path = app.DesignProjectManager.ActiveDesignProject.TemplatesPath; Document doc = app.Documents.Add(DocumentTypeEnum.kPartDocumentObject, path + "Standard.ipt", true); var doc2 = doc.ReturnSpecificDocumentObject(); //var tt = doc2.GetPropertyValue("Author"); var tt = PropertyShim.GetPropertyValue(doc2, "Author"); //only exists in ParDocuments PartComponentDefinition test = null; try { test = doc2.ComponentDefinition; } catch { } try { Assert.IsNotNull(test); } finally { doc.Close(true); } }
public void GoodInput() { Inventor.Application app = ApplicationShim.Instance(); string test = app.DesignProjectManager.ActiveDesignProject.ContentCenterPath; Assert.IsTrue(PathShim.IsContentCenterPath(test, ref app)); }
public void BadInput_Null() { Inventor.Application app = ApplicationShim.Instance(); string test = null; Assert.IsFalse(PathShim.IsLibraryPath(test, ref app)); }
public void BadInput_Empty() { Inventor.Application app = ApplicationShim.Instance(); var test = ""; Assert.IsFalse(PathShim.IsLibraryPath(test, ref app)); }
public void BadInput_WrongPath() { Inventor.Application app = ApplicationShim.Instance(); var test = @"C:\Zarthastoriatarigula\the\fiverth"; Assert.IsFalse(PathShim.IsLibraryPath(test, ref app)); }
public static string InventorShimsPath() { Inventor.Application app = ApplicationShim.Instance(); var path = app.DesignProjectManager.ActiveDesignProject.FullFileName; var test = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(path), "InventorShims"); return(test); }
internal static Document CreatePresentationDocument() { Inventor.Application app = ApplicationShim.Instance(); var path = app.DesignProjectManager.ActiveDesignProject.TemplatesPath; Document doc = app.Documents.Add(DocumentTypeEnum.kPresentationDocumentObject, path + "Standard.ipn", true); return(doc); }
public static Document CreateAssemblyDocument() { Inventor.Application app = ApplicationShim.Instance(); var path = app.DesignProjectManager.ActiveDesignProject.TemplatesPath; Document doc = app.Documents.Add(DocumentTypeEnum.kAssemblyDocumentObject, path + "Standard.iam", true); return(doc); }
public void GoodInput_NoTrailingSlash() { Inventor.Application app = ApplicationShim.Instance(); string test = app.DesignProjectManager.ActiveDesignProject.ContentCenterPath; test = PathShim.TrimEndingDirectorySeparator(test); Assert.IsTrue(PathShim.IsContentCenterPath(test, ref app)); }
public void GetsOrStartsInstance() { Inventor.Application app = ApplicationShim.Instance(); app.Visible = true; var testVariable = app.AssemblyOptions.DeferUpdate; Assert.IsNotNull(testVariable); app.Quit(); app = null; }
public void BadInput_Null() { Inventor.Application app = ApplicationShim.Instance(); app.Documents.CloseAll(); DesignProject dp = app.DesignProjectManager.ActiveDesignProject; dp.Activate(); string test = null; Assert.IsFalse(PathShim.IsContentCenterPath(test, ref app)); }
public void long_doesNotExist() { Inventor.Application app = ApplicationShim.Instance(); var path = app.DesignProjectManager.ActiveDesignProject.TemplatesPath; var doc = app.Documents.Add(DocumentTypeEnum.kPartDocumentObject, path + "Standard.ipt", true); string test = ""; try { Assert.AreEqual(doc.GetPropertyValue("Inventor User Defined Properties", "Bob"), test); } 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 long_doesNotExist() { Inventor.Application app = ApplicationShim.Instance(); var path = app.DesignProjectManager.ActiveDesignProject.TemplatesPath; var doc = app.Documents.Add(DocumentTypeEnum.kPartDocumentObject, path + "Standard.ipt", true); Property test = doc.GetProperty("Inventor Summary Information", "Bob"); try { Assert.IsNull(test); } finally { doc.Close(true); } }
public void long_native() { Inventor.Application app = ApplicationShim.Instance(); var path = app.DesignProjectManager.ActiveDesignProject.TemplatesPath; var doc = app.Documents.Add(DocumentTypeEnum.kPartDocumentObject, path + "Standard.ipt", true); Property test = doc.PropertySets["Inventor Summary Information"]["Title"]; Property result = doc.GetProperty("Inventor Summary Information", "Title"); try { Assert.AreEqual(test, result); } finally { doc.Close(true); } }
public void BadInput_WrongPath(string testString) { Inventor.Application app = ApplicationShim.Instance(); try { Assert.IsFalse(testString.IsLibraryPath(app)); } finally { Marshal.ReleaseComObject(app); app = null; } }
public void long_custom() { Inventor.Application app = ApplicationShim.Instance(); var path = app.DesignProjectManager.ActiveDesignProject.TemplatesPath; var doc = app.Documents.Add(DocumentTypeEnum.kPartDocumentObject, path + "Standard.ipt", true); doc.PropertySets["Inventor User Defined Properties"].Add("Bob", "Stuff"); Property test = doc.PropertySets["Inventor User Defined Properties"]["Stuff"]; try { Assert.AreEqual(doc.GetProperty("Inventor User Defined Properties", "Stuff"), test); } finally { doc.Close(true); } }
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 ParameterDoesNotExist_returnsNull() { Inventor.Application app = ApplicationShim.Instance(); var path = app.DesignProjectManager.ActiveDesignProject.TemplatesPath; Document doc = app.Documents.Add(DocumentTypeEnum.kPartDocumentObject, path + "Standard.ipt", true); Parameter test = doc.GetParameter("testing"); try { Assert.IsNull(test); } finally { doc.Close(true); } }
public void short_native() { Inventor.Application app = ApplicationShim.Instance(); var path = app.DesignProjectManager.ActiveDesignProject.TemplatesPath; var doc = app.Documents.Add(DocumentTypeEnum.kPartDocumentObject, path + "Standard.ipt", true); string test = "Bob"; doc.PropertySets["Inventor Summary Information"]["Title"].Value = test; try { Assert.AreEqual(doc.GetPropertyValue("Title"), test); } finally { doc.Close(true); } }
public void GoodInput() { Inventor.Application app = ApplicationShim.Instance(); string test = app.DesignProjectManager.ActiveDesignProject.ContentCenterPath; try { Assert.IsTrue(test.IsContentCenterPath(app)); } finally { Marshal.ReleaseComObject(app); app = null; } }
public void long_custom() { Inventor.Application app = ApplicationShim.Instance(); var path = app.DesignProjectManager.ActiveDesignProject.TemplatesPath; var doc = app.Documents.Add(DocumentTypeEnum.kPartDocumentObject, path + "Standard.ipt", true); string test = "Bob"; doc.SetPropertyValue("Inventor User Defined Properties", "Stuff", test); string result = (string)doc.PropertySets["Inventor User Defined Properties"]["Stuff"].Value; try { Assert.AreEqual(test, 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); } }