Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
47202c5
Add `ModelBase` with custom `IXmlSerializable`
ricaun May 16, 2025
9712370
Add `DataBase` and `DataBuilderBase`
ricaun May 16, 2025
c88ca4c
Add `DataBuild_Tests` to test `DataBuilder`
ricaun May 16, 2025
8d21528
Update docs
ricaun May 16, 2025
0743399
Add `IncludeSymbols` to support `SymbolPackageFormat`
ricaun May 16, 2025
30d35c9
Update `PrePack`
ricaun May 16, 2025
c22d2c1
Update readme
ricaun May 16, 2025
457e6c8
Update readme
ricaun May 16, 2025
abbd8aa
Update `ExtensibleData`
ricaun May 27, 2025
49f59b9
Version 1.1.0-beta
ricaun May 27, 2025
b970ef2
Add `AutoCADUtils` and `AutoCADExtensibleData`
ricaun May 28, 2025
f9973ea
Add Tests `PackageContentsBuilder_AutoCAD_Tests`
ricaun May 28, 2025
33688f9
Version 1.1.0-beta.1
ricaun May 28, 2025
8855e28
Remove console
ricaun May 28, 2025
e2287e2
Replace IEnumerable to array
ricaun May 30, 2025
f91587c
Update docs Os and Platform
ricaun May 30, 2025
3e4af7c
Version 1.1.0-beta.3
ricaun May 30, 2025
e148e38
Add `InventorUtils` to support `InventorApplication` and `InventorPla…
ricaun Jun 4, 2025
220c82f
Add `IInventorAddInEntryBuilder`, `InventorAddInEntryBuilder` and `In…
ricaun Jun 4, 2025
ab6af2a
Add `InventorAddInsBuilder_Tests` to test `InventorAddInEntryBuilder`
ricaun Jun 4, 2025
84bfcfb
Update `InventorUtils` to have `SupportedSoftwareVersion` extension m…
ricaun Jun 4, 2025
4da887e
Update readme
ricaun Jun 4, 2025
955da13
Add `Max3dsUtils` to support `Max3dsApplication` and `Max3dsPlatform`.
ricaun Jun 4, 2025
09c3123
Support `3ds Max` bundle
ricaun Jun 4, 2025
f198d7b
Update `InventorUtils` to use `SeriesMin/SeriesMax` for `App Store` o…
ricaun Jun 4, 2025
23015b0
Support `Maya` bundle
ricaun Jun 4, 2025
4003e03
Update readme
ricaun Jun 4, 2025
69e5c0d
Add `NavisworksUtils` to support `NavisworksApplication` and `Naviswo…
ricaun Jun 4, 2025
9cc5806
Update readme
ricaun Jun 4, 2025
beaa03e
Version 1.1.0-rc
ricaun Jun 4, 2025
ee5c886
Update to version 2.0.0-rc
ricaun Jun 4, 2025
102e7e4
Update readme
ricaun Jun 4, 2025
f3b20b3
Version 2.0.0-rc.1
ricaun Jun 4, 2025
4c06b7e
Remove Obsolete
ricaun Jun 4, 2025
4a9a29e
Update `ProductCode` and `UpgradeCode` to convert `Guid` to `ToString…
ricaun Jun 5, 2025
59577f8
Update `AppVersion` to convert `Version` to `ToString(3)`.
ricaun Jun 5, 2025
7c85441
Version 2.0.0-rc.2
ricaun Jun 5, 2025
d2abe9c
Version 2.0.0
ricaun Jun 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
168 changes: 168 additions & 0 deletions Autodesk.PackageBuilder.Tests/Addin/InventorAddInsBuilder_Tests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
using Autodesk.PackageBuilder.Tests.Utils;
using NUnit.Framework;
using System;

namespace Autodesk.PackageBuilder.Tests.Addin
{
public class InventorAddInsBuilder_Tests
{
InventorAddInsBuilder builder;
[SetUp]
public void Setup()
{
builder = BuilderUtils.Build<InventorAddInsBuilder>();
}

[Test]
public void Build_InventorAddIn()
{
builder.AssertElement("AddIn");
}

[TestCase("Standard")]
[TestCase("NotStandard")]
public void Build_Create(string type)
{
builder.AddIn.Create(type);
builder.AssertElementAttribute("AddIn", "Type", type);
}

[Test]
public void Build_Create_Empty()
{
string type = "Standard";
builder.AddIn.Create();
builder.AssertElementAttribute("AddIn", "Type", type);
}

[TestCase("Value")]
[TestCase("PropertyValue")]
public void Build_Create_AddInId(string value)
{
builder.AddIn.Create()
.ClassId(value)
.ClientId(value)
.DisplayName(value)
.Description(value)
.Assembly(value);

builder.AssertElement("ClassId", value);
builder.AssertElement("ClientId", value);
builder.AssertElement("DisplayName", value);
builder.AssertElement("Description", value);
builder.AssertElement("Assembly", value);

builder.AssertNotElement("LoadAutomatically");
builder.AssertNotElement("LoadBehavior");
builder.AssertNotElement("UserUnloadable");
builder.AssertNotElement("Hidden");
}

[TestCase("Value", 0)]
[TestCase("PropertyValue", 1)]
public void Build_Create_AddInId_Load(string value, int i)
{
builder.AddIn.Create()
.ClassId(value)
.ClientId(value)
.DisplayName(value)
.Description(value)
.Assembly(value)
.LoadAutomatically(i)
.LoadBehavior(i)
.UserUnloadable(i)
.Hidden(i);

builder.AssertElement("ClassId", value);
builder.AssertElement("ClientId", value);
builder.AssertElement("DisplayName", value);
builder.AssertElement("Description", value);
builder.AssertElement("Assembly", value);

builder.AssertElement("LoadAutomatically", i);
builder.AssertElement("LoadBehavior", i);
builder.AssertElement("UserUnloadable", i);
builder.AssertElement("Hidden", i);
}

[TestCase(28, "28..")]
[TestCase(29, "29..")]
public void Build_Create_AddInId_SupportedSoftwareVersionEqualTo(int version, string expected)
{
builder.AddIn.Create()
.SupportedSoftwareVersion(version);

builder.AssertElement("SupportedSoftwareVersionEqualTo", expected);
builder.AssertNotElement("SupportedSoftwareVersionGreaterThan");
builder.AssertNotElement("SupportedSoftwareVersionLessThan");
}

[TestCase(25, "24..")] // Inventor 2021+
[TestCase(28, "27..")] // Inventor 2024+
[TestCase(29, "28..")] // Inventor 2025+
public void Build_Create_AddInId_SupportedSoftwareVersionGreaterThan(int version, string expected)
{
builder.AddIn.Create()
.SupportedSoftwareVersion(version, 0);

builder.AssertElement("SupportedSoftwareVersionGreaterThan", expected);
builder.AssertNotElement("SupportedSoftwareVersionLessThan");
builder.AssertNotElement("SupportedSoftwareVersionEqualTo");
}

[TestCase(25, "24..", 28, "29..")] // Inventor 2021+ to 2024-
[TestCase(25, "24..", 28, "28..", true)] // Inventor 2021+ to 2024- (not include 2024)
[TestCase(29, "28..", 30, "31..")] // Inventor 2025+ to 2026-
[TestCase(29, "28..", 30, "30..", true)] // Inventor 2025+ to 2026- (not include 2026)
public void Build_Create_AddInId_SupportedSoftwareVersionGreaterAndLessThan(int minVersion, string minExpected, int maxVersion, string maxExpected, bool maxVersionMinusOne = false)
{
builder.AddIn.Create()
.SupportedSoftwareVersion(minVersion, maxVersion, maxVersionMinusOne);

builder.AssertElement("SupportedSoftwareVersionGreaterThan", minExpected);
builder.AssertElement("SupportedSoftwareVersionLessThan", maxExpected);
builder.AssertNotElement("SupportedSoftwareVersionEqualTo");
}

[Test]
public void Build_InventorAddIns_DemoClass()
{
var builder = BuilderUtils.Build<DemoAddinBuilder>();
var content = builder.ToString();
Console.WriteLine(builder.ToString());
Assert.AreEqual(DemoAddinBuilder.Expected, content, $"Expected: {DemoAddinBuilder.Expected}\nContent: {content}");
}

public class DemoAddinBuilder : InventorAddInsBuilder
{
public static string Expected => """"
<?xml version="1.0" encoding="utf-8"?>
<AddIn Type="Standard">
<ClassId>{11111111-2222-3333-4444-55555555555F}</ClassId>
<ClientId>{11111111-2222-3333-4444-55555555555F}</ClientId>
<DisplayName>InventorAddIn</DisplayName>
<Description>InventorAddIn</Description>
<Assembly>InventorAddIn.dll</Assembly>
<LoadBehavior>0</LoadBehavior>
<UserUnloadable>0</UserUnloadable>
<SupportedSoftwareVersionGreaterThan>24..</SupportedSoftwareVersionGreaterThan>
<SupportedSoftwareVersionLessThan>29..</SupportedSoftwareVersionLessThan>
</AddIn>
"""";
public DemoAddinBuilder()
{
var classId = new Guid("11111111-2222-3333-4444-55555555555F");
AddIn.Create()
.ClassId(classId)
.ClientId(classId)
.DisplayName("InventorAddIn")
.Description("InventorAddIn")
.Assembly("InventorAddIn.dll")
.LoadBehavior(0)
.UserUnloadable(0)
.SupportedSoftwareVersionGreaterThan("24..")
.SupportedSoftwareVersionLessThan("29..");
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
using NUnit.Framework;
using Autodesk.PackageBuilder.Extensible.AutoCAD;
using System;
using System.Linq;

namespace Autodesk.PackageBuilder.Tests.Application
{
public class PackageContentsBuilder_AutoCAD_Tests
{
[Test]
public void Build_PackageBuilder_AutoCADClass()
{
var builder = BuilderUtils.Build<AutoCADPackageBuilder>();
var content = builder.ToString();
#if NET6_0
if (AutoCADPackageBuilder.Expected.Equals(content) == false)
Assert.Ignore("Not equal, order not match in version net6.0 for some reason...");
#endif
Assert.AreEqual(AutoCADPackageBuilder.Expected, content, $"Expected: {AutoCADPackageBuilder.Expected}\nContent: {content}");
}

public class AutoCADPackageBuilder : PackageContentsBuilder
{
public static string Expected => """"
<?xml version="1.0" encoding="utf-8"?>
<ApplicationPackage SchemaVersion="1.0" AutodeskProduct="AutoCAD" Name="AutoCADAddin" AppVersion="1.0.0" ProductType="Application">
<CompanyDetails Name="Company Name" Url="url" Email="email" />
<Components Description="AutoCAD 21.0">
<RuntimeRequirements OS="Win64" Platform="AutoCAD*" SeriesMin="R21.0" SeriesMax="R21.0" />
<ComponentEntry AppName="AutoCADAddin" ModuleName="./Contents/2017/AutoCADAddin.dll" AppDescription="AutoCAD Addin for 2017 version" />
</Components>
<Components Description="AutoCAD 22.0">
<RuntimeRequirements OS="Win64" Platform="AutoCAD*" SeriesMin="R22.0" SeriesMax="R22.0" />
<ComponentEntry AppName="AutoCADAddin" ModuleName="./Contents/2018/AutoCADAddin.dll" AppDescription="AutoCAD Addin for 2018 version">
<Commands GroupName="Group">
<Command Global="CommandOpen" Local="CommandOpen" />
<Command Global="CommandClose" Local="CommandClose" />
</Commands>
</ComponentEntry>
</Components>
<Components Description="AutoCAD 23.0">
<RuntimeRequirements OS="Win64" Platform="AutoCAD*" SeriesMin="R23.0" SeriesMax="R23.1" />
<ComponentEntry AppName="AutoCADAddin" ModuleName="./Contents/2019/AutoCADAddin.dll" AppDescription="AutoCAD Addin for 2019 and 2020 versions" LoadOnAppearance="False">
<Commands>
<Command Global="CommandOpen" Local="CommandOpen" />
<Command Global="CommandClose" Local="CommandClose" />
</Commands>
</ComponentEntry>
</Components>
<Components Description="AutoCAD 24.0">
<RuntimeRequirements OS="Win64" Platform="AutoCAD*" SeriesMin="R24.0" SeriesMax="R24.9" />
<ComponentEntry AppName="AutoCADAddin" ModuleName="./Contents/2021/AutoCADAddin.dll" AppDescription="AutoCAD Addin for 2021 to 2024 versions" LoadOnAppearance="True">
<Commands>
<Command Global="CommandOpen" Local="CommandOpen" />
<Command Global="CommandClose" Local="CommandClose" />
</Commands>
</ComponentEntry>
</Components>
<Components Description="AutoCAD 25.0">
<RuntimeRequirements OS="Win64" Platform="AutoCAD*" SeriesMin="R25.0" />
<ComponentEntry AppName="AutoCADAddin" ModuleName="./Contents/2025/AutoCADAddin.dll" AppDescription="AutoCAD Addin for 2025 and later versions" LoadOnAppearance="True">
<Commands>
<Command Global="CommandClose" Local="CommandClose" />
</Commands>
</ComponentEntry>
</Components>
</ApplicationPackage>
"""";
public AutoCADPackageBuilder()
{
var commends = new[] { "CommandOpen", "CommandClose" };
var commandGroup = "Group";

ApplicationPackage
.Create()
.AutoCADApplication()
.Name("AutoCADAddin")
.AppVersion("1.0.0");

CompanyDetails
.Create("Company Name")
.Url("url")
.Email("email");

Components
.CreateEntry("AutoCAD 21.0")
.OS("Win64")
.Platform("AutoCAD*")
.SeriesMin("R21.0")
.SeriesMax("R21.0")
.AppDescription("AutoCAD Addin for 2017 version")
.AppName("AutoCADAddin")
.ModuleName(@"./Contents/2017/AutoCADAddin.dll")
.Commands();

Components
.CreateEntry("AutoCAD 22.0")
.AutoCADPlatform("22.0")
.AppDescription("AutoCAD Addin for 2018 version")
.AppName("AutoCADAddin")
.ModuleName(@"./Contents/2018/AutoCADAddin.dll")
.CommandGroups(commandGroup, commends);

Components
.CreateEntry("AutoCAD 23.0")
.AutoCADPlatform("23.0", "23.1")
.AppDescription("AutoCAD Addin for 2019 and 2020 versions")
.AppName("AutoCADAddin")
.ModuleName(@"./Contents/2019/AutoCADAddin.dll")
.LoadOnAppearance(false)
.Commands(commends);

Components
.CreateEntry("AutoCAD 24.0")
.AutoCADPlatform("24.0", "25.0", true)
.AppDescription("AutoCAD Addin for 2021 to 2024 versions")
.AppName("AutoCADAddin")
.ModuleName(@"./Contents/2021/AutoCADAddin.dll")
.LoadOnAppearance()
.Commands(commends);

Components
.CreateEntry("AutoCAD 25.0")
.AutoCADPlatform("25.0", null)
.AppDescription("AutoCAD Addin for 2025 and later versions")
.AppName("AutoCADAddin")
.ModuleName(@"./Contents/2025/AutoCADAddin.dll")
.LoadOnAppearance()
.Commands(commends.LastOrDefault());

}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
using NUnit.Framework;

namespace Autodesk.PackageBuilder.Tests.Application
{
public class PackageContentsBuilder_Inventor_Tests
{
[Test]
public void Build_PackageBuilder_InventorClass()
{
var builder = BuilderUtils.Build<InventorPackageBuilder>();
var content = builder.ToString();
#if NET6_0
if (InventorPackageBuilder.Expected.Equals(content) == false)
Assert.Ignore("Not equal, order not match in version net6.0 for some reason...");
#endif
Assert.AreEqual(InventorPackageBuilder.Expected, content, $"Expected: {InventorPackageBuilder.Expected}\nContent: {content}");
}

public class InventorPackageBuilder : PackageContentsBuilder
{
public static string Expected => """"
<?xml version="1.0" encoding="utf-8"?>
<ApplicationPackage SchemaVersion="1.0" AutodeskProduct="Inventor" Name="InventorAddin" AppVersion="1.0.0" ProductType="Application">
<CompanyDetails Name="Company Name" Url="url" Email="email" />
<Components Description="Inventor 2024">
<RuntimeRequirements OS="Win64" Platform="Inventor" SeriesMin="Ir25" SeriesMax="Ir28" />
<ComponentEntry AppName="InventorAddin" ModuleName="./Contents/2024/InventorAddin.addin" />
</Components>
<Components Description="Inventor 2025">
<RuntimeRequirements OS="Win64" Platform="Inventor" SeriesMin="Ir29" />
<ComponentEntry AppName="InventorAddin" ModuleName="./Contents/2025/InventorAddin.addin" />
</Components>
</ApplicationPackage>
"""";
public InventorPackageBuilder()
{
ApplicationPackage
.Create()
.InventorApplication()
.Name("InventorAddin")
.AppVersion("1.0.0");

CompanyDetails
.Create("Company Name")
.Url("url")
.Email("email");

Components
.CreateEntry("Inventor 2024")
.InventorPlatform(25, 29, true)
.AppName("InventorAddin")
.ModuleName(@"./Contents/2024/InventorAddin.addin");

Components
.CreateEntry("Inventor 2025")
.InventorPlatform(29, 0)
.AppName("InventorAddin")
.ModuleName(@"./Contents/2025/InventorAddin.addin");
}
}
}
}
Loading