diff --git a/Autodesk.PackageBuilder.Tests/BuilderUtils_Tests.cs b/Autodesk.PackageBuilder.Tests/BuilderUtils_Tests.cs index 8bc62e0..55e3bf3 100644 --- a/Autodesk.PackageBuilder.Tests/BuilderUtils_Tests.cs +++ b/Autodesk.PackageBuilder.Tests/BuilderUtils_Tests.cs @@ -29,6 +29,17 @@ public void Build_ShouldBe_NotNull_Config() Assert.IsTrue(builder.Config); } + [TestCase("path")] + [TestCase("path2")] + [TestCase("path3")] + public void Build_ShouldBe_Config_Build(string path) + { + var builder = BuilderUtils.Build((build) => { build.Config = true; }); + builder.Build(path); + Assert.IsTrue(builder.Config); + Assert.AreEqual(builder.Path, path); + } + [TestCase("path")] [TestCase("path2")] [TestCase("path3")] @@ -41,11 +52,21 @@ public void Build_ShouldBe_Path(string path) [TestCase("path")] [TestCase("path2")] [TestCase("path3")] - public void Build_ShouldBe_Path_Config(string path) + public void Build_ShouldBe_Config_Path(string path) { var builder = BuilderUtils.Build((build) => { build.Config = true; }, path); Assert.IsTrue(builder.Config); Assert.AreEqual(builder.Path, path); } + + [TestCase("path")] + [TestCase("path2")] + [TestCase("path3")] + public void Build_ShouldBe_Path_Config(string path) + { + var builder = BuilderUtils.Build(path, (build) => { build.Config = true; }); + Assert.IsTrue(builder.Config); + Assert.AreEqual(builder.Path, path); + } } } \ No newline at end of file diff --git a/Autodesk.PackageBuilder/Utils/BuilderUtils.cs b/Autodesk.PackageBuilder/Utils/BuilderUtils.cs index b0d4456..98ebc8a 100644 --- a/Autodesk.PackageBuilder/Utils/BuilderUtils.cs +++ b/Autodesk.PackageBuilder/Utils/BuilderUtils.cs @@ -32,6 +32,19 @@ public static TBuilder Build(string path) return builder; } + /// + /// Create a new instance of the type, the instance, and . + /// + /// + /// + /// + /// + public static TBuilder Build(string path, Action config) + where TBuilder : IBuilder, new() + { + return Build(config, path); + } + /// /// Create a new instance of the type, the instance, and . /// diff --git a/CHANGELOG.md b/CHANGELOG.md index ec5c40b..072e7d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,9 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [1.0.6] / 2023-11-24 +## [1.0.6] / 2023-11-24 - 2023-12-06 ### Features - `Tests` project. +- Update `BuilderUtils` to return instance and features (#16). ### PackageBuilder - Enable `DocumentationFile` in package. - Update `BuilderUtils` to return instance. diff --git a/README.md b/README.md index 1a37897..32e3f23 100644 --- a/README.md +++ b/README.md @@ -122,7 +122,15 @@ BuilderUtils.Build("PackageContents.xml"); // or +BuilderUtils.Build("PackageContents.xml", builder => {...}); + +// or + BuilderUtils.Build(builder => {...}, "PackageContents.xml"); + +// or + +BuilderUtils.Build(builder => {...}).Build("PackageContents.xml"); ``` ### Create RevitAddin.addin @@ -197,7 +205,15 @@ BuilderUtils.Build("RevitAddin.addin"); // or +BuilderUtils.Build("RevitAddin.addin", builder => {...}); + +// or + BuilderUtils.Build(builder => {...}, "RevitAddin.addin"); + +// or + +BuilderUtils.Build(builder => {...}).Build("RevitAddin.addin"); ``` ## Package Inspiration / Reference