-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from ricaun-io/develop
Version 1.0.6
- Loading branch information
Showing
40 changed files
with
915 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
Autodesk.PackageBuilder.Examples/Autodesk.PackageBuilder.Example.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 110 additions & 0 deletions
110
Autodesk.PackageBuilder.Tests/Addin/RevitAddInsBuilder_Tests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
using Autodesk.PackageBuilder.Tests.Utils; | ||
using NUnit.Framework; | ||
using System; | ||
|
||
namespace Autodesk.PackageBuilder.Tests.Addin | ||
{ | ||
public class RevitAddInsBuilder_Tests | ||
{ | ||
RevitAddInsBuilder builder; | ||
[SetUp] | ||
public void Setup() | ||
{ | ||
builder = BuilderUtils.Build<RevitAddInsBuilder>(); | ||
} | ||
|
||
[Test] | ||
public void Build_RevitAddIns() | ||
{ | ||
builder.AssertElement("RevitAddIns"); | ||
} | ||
|
||
[TestCase("Command")] | ||
[TestCase("Application")] | ||
[TestCase("DBApplication")] | ||
public void Build_CreateEntry(string type) | ||
{ | ||
builder.AddIn.CreateEntry(type); | ||
builder.AssertElementAttribute("AddIn", "Type", type); | ||
} | ||
|
||
[Test] | ||
public void Build_CreateEntry_Empty() | ||
{ | ||
string type = "Application"; | ||
builder.AddIn.CreateEntry(); | ||
builder.AssertElementAttribute("AddIn", "Type", type); | ||
} | ||
|
||
[TestCase("Value")] | ||
[TestCase("PropertyValue")] | ||
public void Build_CreateEntry_AddInId(string value) | ||
{ | ||
builder.AddIn.CreateEntry() | ||
.Name(value) | ||
.Assembly(value) | ||
.AddInId(value) | ||
.FullClassName(value) | ||
.VendorId(value) | ||
.VendorDescription(value); | ||
|
||
builder.AssertElement("Name", value); | ||
builder.AssertElement("Assembly", value); | ||
builder.AssertElement("AddInId", value); | ||
builder.AssertElement("FullClassName", value); | ||
builder.AssertElement("VendorId", value); | ||
builder.AssertElement("VendorDescription", value); | ||
} | ||
|
||
[TestCase(5)] | ||
[TestCase(9)] | ||
public void Build_CreateEntry_AddInId_Multiple(int length) | ||
{ | ||
for (int i = 0; i < length; i++) | ||
{ | ||
builder.AddIn.CreateEntry() | ||
.Name(i.ToString()); | ||
} | ||
|
||
for (int i = 0; i < length; i++) | ||
{ | ||
builder.AssertElement("Name", i); | ||
} | ||
} | ||
|
||
[Test] | ||
public void Build_RevitAddIns_DemoClass() | ||
{ | ||
var builder = BuilderUtils.Build<DemoAddinBuilder>(); | ||
var content = builder.ToString(); | ||
Assert.AreEqual(DemoAddinBuilder.Expected, content, $"Expected: {DemoAddinBuilder.Expected}\nContent: {content}"); | ||
} | ||
|
||
public class DemoAddinBuilder : RevitAddInsBuilder | ||
{ | ||
public static string Expected => """" | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<RevitAddIns> | ||
<AddIn Type="Application"> | ||
<Name>RevitAddin</Name> | ||
<Assembly>RevitAddin.dll</Assembly> | ||
<AddInId>11111111-2222-3333-4444-555555555555</AddInId> | ||
<FullClassName>RevitAddin.App</FullClassName> | ||
<VendorId>RevitAddin</VendorId> | ||
<VendorDescription>RevitAddin</VendorDescription> | ||
</AddIn> | ||
</RevitAddIns> | ||
""""; | ||
public DemoAddinBuilder() | ||
{ | ||
AddIn.CreateEntry("Application") | ||
.Name("RevitAddin") | ||
.Assembly("RevitAddin.dll") | ||
.AddInId("11111111-2222-3333-4444-555555555555") | ||
.FullClassName("RevitAddin.App") | ||
.VendorId("RevitAddin") | ||
.VendorDescription("RevitAddin"); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using Autodesk.PackageBuilder.Tests.Utils; | ||
using NUnit.Framework; | ||
|
||
namespace Autodesk.PackageBuilder.Tests.Addin | ||
{ | ||
public class RevitUtils_Tests | ||
{ | ||
PackageContentsBuilder builder; | ||
[SetUp] | ||
public void Setup() | ||
{ | ||
builder = BuilderUtils.Build<PackageContentsBuilder>(); | ||
} | ||
|
||
[Test] | ||
public void Build_RevitApplication() | ||
{ | ||
builder.ApplicationPackage.Create() | ||
.RevitApplication(); | ||
|
||
builder.AssertAttribute("AutodeskProduct", AutodeskProducts.Revit); | ||
builder.AssertAttribute("ProductType", ProductTypes.Application); | ||
} | ||
|
||
[TestCase(2021)] | ||
[TestCase(2022)] | ||
[TestCase(2023)] | ||
[TestCase(2024)] | ||
public void Build_RevitPlatform(int revitVersion) | ||
{ | ||
var description = "RevitPlatform"; | ||
builder.Components | ||
.CreateEntry(description) | ||
.RevitPlatform(revitVersion); | ||
|
||
builder.AssertAttribute("Description", description); | ||
builder.AssertAttribute("OS", "Win64"); | ||
builder.AssertAttribute("Platform", "Revit"); | ||
builder.AssertAttribute("SeriesMin", "R" + revitVersion); | ||
builder.AssertAttribute("SeriesMax", "R" + revitVersion); | ||
} | ||
} | ||
} |
Oops, something went wrong.