From 66de95937340c1e709723c0cb36e14b41e7c9fed Mon Sep 17 00:00:00 2001 From: Marcin Celej Date: Thu, 28 Dec 2023 07:29:36 +0100 Subject: [PATCH] #27: Added version number to public api description of external packages --- .../Public/Api.of.Synergy.Documentation.verified.md | 3 ++- .../Architecture/Public/Package.cs | 2 +- .../Architecture/Public/Package.of.Verify.Xunit.verified.md | 2 +- .../Architecture/Public/Package.of.xunit.core.verified.md | 2 +- Documentation/Synergy.Documentation/Api/ApiDescription.cs | 5 ++++- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Documentation/Synergy.Documentation.Tests/Architecture/Public/Api.of.Synergy.Documentation.verified.md b/Documentation/Synergy.Documentation.Tests/Architecture/Public/Api.of.Synergy.Documentation.verified.md index da5634b..e5713ab 100644 --- a/Documentation/Synergy.Documentation.Tests/Architecture/Public/Api.of.Synergy.Documentation.verified.md +++ b/Documentation/Synergy.Documentation.Tests/Architecture/Public/Api.of.Synergy.Documentation.verified.md @@ -6,7 +6,8 @@ withAttributes: bool [Optional] ) : string - ApiDescription.GenerateFor( - assembly: Assembly + assembly: Assembly, + includeAssemblyVersion: bool [Optional] ) : string - ApiDescription.GenerateFor( types: IEnumerable, diff --git a/Documentation/Synergy.Documentation.Tests/Architecture/Public/Package.cs b/Documentation/Synergy.Documentation.Tests/Architecture/Public/Package.cs index f8e1cb8..49bbb30 100644 --- a/Documentation/Synergy.Documentation.Tests/Architecture/Public/Package.cs +++ b/Documentation/Synergy.Documentation.Tests/Architecture/Public/Package.cs @@ -14,7 +14,7 @@ public async Task Generate(Type type) var assembly = type.Assembly; // ACT - var publicApi = ApiDescription.GenerateFor(assembly); + var publicApi = ApiDescription.GenerateFor(assembly, includeAssemblyVersion: true); // ASSERT await Verifier.Verify(publicApi, "md") diff --git a/Documentation/Synergy.Documentation.Tests/Architecture/Public/Package.of.Verify.Xunit.verified.md b/Documentation/Synergy.Documentation.Tests/Architecture/Public/Package.of.Verify.Xunit.verified.md index e5bed2e..f7e9061 100644 --- a/Documentation/Synergy.Documentation.Tests/Architecture/Public/Package.of.Verify.Xunit.verified.md +++ b/Documentation/Synergy.Documentation.Tests/Architecture/Public/Package.of.Verify.Xunit.verified.md @@ -1,4 +1,4 @@ -# Verify.Xunit +# Verify.Xunit 1.0.0.0 ## VerifyXunit.DerivePathInfo (class) : MulticastDelegate, ICloneable, ISerializable - Method: MethodInfo { get; } diff --git a/Documentation/Synergy.Documentation.Tests/Architecture/Public/Package.of.xunit.core.verified.md b/Documentation/Synergy.Documentation.Tests/Architecture/Public/Package.of.xunit.core.verified.md index 6bc3478..a0a8eb3 100644 --- a/Documentation/Synergy.Documentation.Tests/Architecture/Public/Package.of.xunit.core.verified.md +++ b/Documentation/Synergy.Documentation.Tests/Architecture/Public/Package.of.xunit.core.verified.md @@ -1,4 +1,4 @@ -# xunit.core +# xunit.core 2.4.2.0 ## Xunit.AssemblyTraitAttribute (attribute) : Attribute, ITraitAttribute - ctor( diff --git a/Documentation/Synergy.Documentation/Api/ApiDescription.cs b/Documentation/Synergy.Documentation/Api/ApiDescription.cs index bb834f1..7fbee62 100644 --- a/Documentation/Synergy.Documentation/Api/ApiDescription.cs +++ b/Documentation/Synergy.Documentation/Api/ApiDescription.cs @@ -12,11 +12,14 @@ public static class ApiDescription { static readonly BindingFlags bindingFlags = BindingFlags.FlattenHierarchy | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public; - public static string GenerateFor(Assembly assembly) + public static string GenerateFor(Assembly assembly, bool includeAssemblyVersion = false) { var description = new StringBuilder(); var assemblyName = assembly.GetName().Name; + if (includeAssemblyVersion) + assemblyName += " " + assembly.GetName().Version; + description.AppendLine($"# {assemblyName}"); description.AppendLine();