Skip to content

Commit

Permalink
Merge pull request #17 from ricaun-io/develop
Browse files Browse the repository at this point in the history
Version 1.0.6
  • Loading branch information
ricaun authored Dec 6, 2023
2 parents 49f4528 + 7b673d0 commit 9764ca5
Show file tree
Hide file tree
Showing 40 changed files with 915 additions and 34 deletions.
9 changes: 0 additions & 9 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,6 @@ jobs:
steps:
- uses: actions/checkout@v1

- name: NuGet Setup
uses: actions/setup-dotnet@v2
with:
dotnet-version: |
6.0.x
7.0.x
- name: "NuGet Add Source Organization"
run: if ("${{ secrets.ORGANIZATION_SOURCE_PACKAGE_PASSWORD }}" -ne "") { dotnet nuget add source --username ${{ secrets.ORGANIZATION_SOURCE_PACKAGE_USERNAME }} --password ${{ secrets.ORGANIZATION_SOURCE_PACKAGE_PASSWORD }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/${{github.repository_owner}}/index.json" }

- name: Run './build/build.cmd'
run: ./build/build.cmd --root ./build
env:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFrameworks>net4.8;net6.0;net8.0</TargetFrameworks>
<IsPackable>false</IsPackable>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Autodesk.PackageBuilder.Examples/DemoAddinBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ public DemoAddinBuilder()
{
AddIn.CreateEntry("Application")
.Name("RevitAddin")
.AddInId("F6DB5994-D788-4060-9C97-16F6C1B07857")
.Assembly("RevitAddin.dll")
.AddInId("11111111-2222-3333-4444-555555555555")
.FullClassName("RevitAddin.App")
.VendorId("RevitAddin")
.VendorDescription("RevitAddin");
Expand Down
2 changes: 1 addition & 1 deletion Autodesk.PackageBuilder.Examples/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ static void BuildAddinFile()
{
builder.AddIn.CreateEntry("Application")
.Name("RevitAddin")
.AddInId("F6DB5994-D788-4060-9C97-16F6C1B07857")
.Assembly("RevitAddin.dll")
.AddInId("11111111-2222-3333-4444-555555555555")
.FullClassName("RevitAddin.App")
.VendorId("RevitAddin")
.VendorDescription("RevitAddin");
Expand Down
110 changes: 110 additions & 0 deletions Autodesk.PackageBuilder.Tests/Addin/RevitAddInsBuilder_Tests.cs
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");
}
}
}
}
43 changes: 43 additions & 0 deletions Autodesk.PackageBuilder.Tests/Addin/RevitUtils_Tests.cs
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);
}
}
}
Loading

0 comments on commit 9764ca5

Please sign in to comment.