Skip to content

Commit

Permalink
#27: Added version number to public api description of external packages
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcinCelej committed Dec 28, 2023
1 parent a8ded93 commit 66de959
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
withAttributes: bool [Optional]
) : string
- ApiDescription.GenerateFor(
assembly: Assembly
assembly: Assembly,
includeAssemblyVersion: bool [Optional]
) : string
- ApiDescription.GenerateFor(
types: IEnumerable<Type>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Verify.Xunit
# Verify.Xunit 1.0.0.0

## VerifyXunit.DerivePathInfo (class) : MulticastDelegate, ICloneable, ISerializable
- Method: MethodInfo { get; }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# xunit.core
# xunit.core 2.4.2.0

## Xunit.AssemblyTraitAttribute (attribute) : Attribute, ITraitAttribute
- ctor(
Expand Down
5 changes: 4 additions & 1 deletion Documentation/Synergy.Documentation/Api/ApiDescription.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit 66de959

Please sign in to comment.