Skip to content

Commit

Permalink
Merge pull request #1172 from Evangelink/fix-extension-version
Browse files Browse the repository at this point in the history
Fix NUnit extension version
  • Loading branch information
OsirisTerje authored May 12, 2024
2 parents 4010a76 + 2919fcf commit 095f8f8
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/NUnitTestAdapter/TestingPlatformAdapter/NUnitExtension.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Threading.Tasks;
using System.Reflection;
using System.Threading.Tasks;

using Microsoft.Testing.Platform.Extensions;

Expand All @@ -10,11 +11,18 @@ internal sealed class NUnitExtension : IExtension

public string DisplayName => "NUnit";

// TODO: Decide whether to read from assembly or use hardcoded string.
public string Version => "4.5.0";
public string Version { get; } = GetAssemblyVersion();

public string Description => "NUnit adapter for Microsoft Testing Platform";

public Task<bool> IsEnabledAsync() => Task.FromResult(true);

private static string GetAssemblyVersion()
{
var assembly = typeof(NUnitExtension).Assembly;
var version = assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion
?? assembly.GetName().Version?.ToString();
return version;
}
}
}

0 comments on commit 095f8f8

Please sign in to comment.