#region ========================================================================= USING ===================================================================================== using Nemera.Presentation.Api; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Reflection; #endregion namespace Nemera.Presentation.Api.IntegrationTests.Common.Setup; /// /// Determines whether the API assembly was produced by an official release build. /// [ExcludeFromCodeCoverage] public static class OfficialReleaseBuildDetector { /// /// Determines whether the API assembly was produced by an official release build. /// /// when the assembly carries the official release marker, otherwise. public static bool IsOfficialReleaseBuild() { // The marker is injected by OfficialReleaseBuildAssemblyInfo.cs when the official build defines OFFICIAL_RELEASE_BUILD. // The tests inspect Program's assembly rather than their own, because the test assembly is not the shipped API assembly. return typeof(Program).Assembly .GetCustomAttributes() .Any(attribute => attribute.Key == "OfficialReleaseBuild" && attribute.Value == "true"); } }