From 520325ee26c80a162fd16f896e286102e16bedea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20St=C3=BChmer?= Date: Thu, 19 Dec 2024 09:01:26 +0100 Subject: [PATCH 1/2] chore: Added public api tests --- Directory.Packages.props | 3 +- .../SqlCheckBase.cs | 2 +- .../HealthCheckArchitecture.cs | 46 +++--------- ...olve.HealthChecks.Tests.Integration.csproj | 1 + .../PublicApiTests.cs | 73 +++++++++++++++++++ ...ublicApi_HasNotChanged_Theory.verified.txt | 20 +++++ ...ublicApi_HasNotChanged_Theory.verified.txt | 39 ++++++++++ ...ublicApi_HasNotChanged_Theory.verified.txt | 39 ++++++++++ ...ublicApi_HasNotChanged_Theory.verified.txt | 39 ++++++++++ ...ublicApi_HasNotChanged_Theory.verified.txt | 14 ++++ ...ublicApi_HasNotChanged_Theory.verified.txt | 14 ++++ ...ublicApi_HasNotChanged_Theory.verified.txt | 14 ++++ ...ublicApi_HasNotChanged_Theory.verified.txt | 14 ++++ ...ublicApi_HasNotChanged_Theory.verified.txt | 14 ++++ ...ublicApi_HasNotChanged_Theory.verified.txt | 8 ++ ...ublicApi_HasNotChanged_Theory.verified.txt | 19 +++++ ...ublicApi_HasNotChanged_Theory.verified.txt | 20 +++++ ...ublicApi_HasNotChanged_Theory.verified.txt | 14 ++++ ...ublicApi_HasNotChanged_Theory.verified.txt | 14 ++++ ...ublicApi_HasNotChanged_Theory.verified.txt | 14 ++++ 20 files changed, 384 insertions(+), 37 deletions(-) create mode 100644 tests/NetEvolve.HealthChecks.Tests.Integration/PublicApiTests.cs create mode 100644 tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.Apache.Kafka.PublicApi_HasNotChanged_Theory.verified.txt create mode 100644 tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.Azure.Blobs.PublicApi_HasNotChanged_Theory.verified.txt create mode 100644 tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.Azure.Queues.PublicApi_HasNotChanged_Theory.verified.txt create mode 100644 tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.Azure.Tables.PublicApi_HasNotChanged_Theory.verified.txt create mode 100644 tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.ClickHouse.PublicApi_HasNotChanged_Theory.verified.txt create mode 100644 tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.MySql.Connector.PublicApi_HasNotChanged_Theory.verified.txt create mode 100644 tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.MySql.PublicApi_HasNotChanged_Theory.verified.txt create mode 100644 tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.Npgsql.PublicApi_HasNotChanged_Theory.verified.txt create mode 100644 tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.Oracle.PublicApi_HasNotChanged_Theory.verified.txt create mode 100644 tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.PublicApi_HasNotChanged_Theory.verified.txt create mode 100644 tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.Redis.PublicApi_HasNotChanged_Theory.verified.txt create mode 100644 tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.Redpanda.PublicApi_HasNotChanged_Theory.verified.txt create mode 100644 tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.SQLite.PublicApi_HasNotChanged_Theory.verified.txt create mode 100644 tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.SqlServer.Legacy.PublicApi_HasNotChanged_Theory.verified.txt create mode 100644 tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.SqlServer.PublicApi_HasNotChanged_Theory.verified.txt diff --git a/Directory.Packages.props b/Directory.Packages.props index 26b3187..6754c03 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -37,6 +37,7 @@ + @@ -60,4 +61,4 @@ - + \ No newline at end of file diff --git a/src/NetEvolve.HealthChecks.Abstractions/SqlCheckBase.cs b/src/NetEvolve.HealthChecks.Abstractions/SqlCheckBase.cs index 1b81030..57e701e 100644 --- a/src/NetEvolve.HealthChecks.Abstractions/SqlCheckBase.cs +++ b/src/NetEvolve.HealthChecks.Abstractions/SqlCheckBase.cs @@ -12,7 +12,7 @@ /// /// Configurable implementation of with focus on based implementations. /// -/// +/// Type of Configuration public abstract class SqlCheckBase : IHealthCheck where TConfiguration : class, ISqlCheckOptions { diff --git a/tests/NetEvolve.HealthChecks.Tests.Architecture/HealthCheckArchitecture.cs b/tests/NetEvolve.HealthChecks.Tests.Architecture/HealthCheckArchitecture.cs index f9a5772..a546460 100644 --- a/tests/NetEvolve.HealthChecks.Tests.Architecture/HealthCheckArchitecture.cs +++ b/tests/NetEvolve.HealthChecks.Tests.Architecture/HealthCheckArchitecture.cs @@ -4,21 +4,6 @@ using System.Threading; using ArchUnitNET.Domain; using ArchUnitNET.Loader; -using NetEvolve.HealthChecks.Apache.Kafka; -using NetEvolve.HealthChecks.Azure.Blobs; -using NetEvolve.HealthChecks.Azure.Queues; -using NetEvolve.HealthChecks.Azure.Tables; -using NetEvolve.HealthChecks.ClickHouse; -using NetEvolve.HealthChecks.Dapr; -using NetEvolve.HealthChecks.Npgsql; -using NetEvolve.HealthChecks.Oracle; -using NetEvolve.HealthChecks.Redis; -using NetEvolve.HealthChecks.Redpanda; -using NetEvolve.HealthChecks.SQLite; -using NetEvolve.HealthChecks.SqlServer; -using NetEvolve.HealthChecks.SqlServer.Legacy; -using MySqlCheck = MySql.MySqlCheck; -using MySqlConnectorCheck = MySql.Connector.MySqlCheck; internal static class HealthCheckArchitecture { @@ -32,25 +17,17 @@ internal static class HealthCheckArchitecture private static Architecture LoadArchitecture() { - System.Reflection.Assembly[] assemblies = - [ - typeof(KafkaCheck).Assembly, - typeof(BlobContainerAvailableHealthCheck).Assembly, - typeof(QueueClientAvailableHealthCheck).Assembly, - typeof(TableClientAvailableHealthCheck).Assembly, - typeof(ClickHouseCheck).Assembly, - typeof(DaprHealthCheck).Assembly, - typeof(MySqlCheck).Assembly, - typeof(MySqlConnectorCheck).Assembly, - typeof(NpgsqlCheck).Assembly, - typeof(OracleCheck).Assembly, - typeof(RedisDatabaseHealthCheck).Assembly, - typeof(RedpandaCheck).Assembly, - typeof(SQLiteCheck).Assembly, - typeof(SqlServerCheck).Assembly, - typeof(SqlServerLegacyCheck).Assembly, - ]; - var architecture = new ArchLoader() + var assemblies = System + .Reflection.Assembly.GetExecutingAssembly()! + .GetReferencedAssemblies() + .Where(a => + a.Name?.StartsWith("NetEvolve.HealthChecks", StringComparison.OrdinalIgnoreCase) + == true + ) + .Select(System.Reflection.Assembly.Load) + .ToArray(); + + return new ArchLoader() .LoadAssembliesRecursively( assemblies, x => @@ -62,6 +39,5 @@ private static Architecture LoadArchitecture() : FilterResult.SkipAndContinue ) .Build(); - return architecture; } } diff --git a/tests/NetEvolve.HealthChecks.Tests.Integration/NetEvolve.HealthChecks.Tests.Integration.csproj b/tests/NetEvolve.HealthChecks.Tests.Integration/NetEvolve.HealthChecks.Tests.Integration.csproj index c6dd3b1..d22a7ed 100644 --- a/tests/NetEvolve.HealthChecks.Tests.Integration/NetEvolve.HealthChecks.Tests.Integration.csproj +++ b/tests/NetEvolve.HealthChecks.Tests.Integration/NetEvolve.HealthChecks.Tests.Integration.csproj @@ -15,6 +15,7 @@ + diff --git a/tests/NetEvolve.HealthChecks.Tests.Integration/PublicApiTests.cs b/tests/NetEvolve.HealthChecks.Tests.Integration/PublicApiTests.cs new file mode 100644 index 0000000..cbdefb5 --- /dev/null +++ b/tests/NetEvolve.HealthChecks.Tests.Integration/PublicApiTests.cs @@ -0,0 +1,73 @@ +namespace NetEvolve.HealthChecks.Tests.Integration; + +using System.ComponentModel; +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.Versioning; +using PublicApiGenerator; + +public class PublicApiTests +{ + private static readonly string[] _excludedAttributes = + [ + typeof(InternalsVisibleToAttribute).FullName!, + "System.Runtime.CompilerServices.IsByRefLikeAttribute", + typeof(TargetFrameworkAttribute).FullName!, + typeof(CLSCompliantAttribute).FullName!, + typeof(AssemblyMetadataAttribute).FullName!, + typeof(NeutralResourcesLanguageAttribute).FullName!, + typeof(AttributeUsageAttribute).FullName!, + ]; + + [Theory] + [MemberData(nameof(GetAssemblies))] + public Task PublicApi_HasNotChanged_Theory(Assembly assembly) + { + Assert.NotNull(assembly); + + var types = assembly.GetTypes().Where(IsVisibleToIntelliSense).ToArray(); + + var options = new ApiGeneratorOptions + { + ExcludeAttributes = _excludedAttributes, + IncludeTypes = types, + }; + + var publicApi = assembly.GeneratePublicApi(options); + + return Verify(publicApi).UseTypeName(assembly.GetName().Name); + } + + public static TheoryData GetAssemblies + { + get + { + var assemblies = Assembly + .GetExecutingAssembly()! + .GetReferencedAssemblies() + .Where(a => + a.Name?.StartsWith("NetEvolve.HealthChecks", StringComparison.OrdinalIgnoreCase) + == true + ) + .Select(Assembly.Load) + .ToArray(); + + var data = new TheoryData(); + data.AddRange(assemblies); + return data; + } + } + + private static bool IsVisibleToIntelliSense(Type type) + { + var browsable = type.GetCustomAttribute(); + if (browsable is null || browsable.Browsable) + { + return true; + } + + var editorBrowsable = type.GetCustomAttribute(); + return editorBrowsable is null || editorBrowsable.State != EditorBrowsableState.Never; + } +} diff --git a/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.Apache.Kafka.PublicApi_HasNotChanged_Theory.verified.txt b/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.Apache.Kafka.PublicApi_HasNotChanged_Theory.verified.txt new file mode 100644 index 0000000..1484fe6 --- /dev/null +++ b/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.Apache.Kafka.PublicApi_HasNotChanged_Theory.verified.txt @@ -0,0 +1,20 @@ +namespace NetEvolve.HealthChecks.Apache.Kafka +{ + public static class DependencyInjectionExtensions + { + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddKafka([System.Diagnostics.CodeAnalysis.NotNull] this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, [System.Diagnostics.CodeAnalysis.NotNull] string name, System.Action? options = null, params string[] tags) { } + } + public class KafkaOptions + { + public KafkaOptions() { } + public Confluent.Kafka.ProducerConfig Configuration { get; set; } + public NetEvolve.HealthChecks.Apache.Kafka.ProducerHandleMode Mode { get; set; } + public int Timeout { get; set; } + public string Topic { get; set; } + } + public enum ProducerHandleMode + { + ServiceProvider = 0, + Create = 1, + } +} \ No newline at end of file diff --git a/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.Azure.Blobs.PublicApi_HasNotChanged_Theory.verified.txt b/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.Azure.Blobs.PublicApi_HasNotChanged_Theory.verified.txt new file mode 100644 index 0000000..b92f13f --- /dev/null +++ b/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.Azure.Blobs.PublicApi_HasNotChanged_Theory.verified.txt @@ -0,0 +1,39 @@ +namespace NetEvolve.HealthChecks.Azure.Blobs +{ + public enum BlobClientCreationMode + { + ServiceProvider = 0, + DefaultAzureCredentials = 1, + ConnectionString = 2, + SharedKey = 3, + AzureSasCredential = 4, + } + public sealed class BlobContainerAvailableOptions + { + public BlobContainerAvailableOptions() { } + public string? AccountKey { get; set; } + public string? AccountName { get; set; } + public System.Action? ConfigureClientOptions { get; set; } + public string? ConnectionString { get; set; } + public string? ContainerName { get; set; } + public NetEvolve.HealthChecks.Azure.Blobs.BlobClientCreationMode Mode { get; set; } + public System.Uri? ServiceUri { get; set; } + public int Timeout { get; set; } + } + public sealed class BlobServiceAvailableOptions + { + public BlobServiceAvailableOptions() { } + public string? AccountKey { get; set; } + public string? AccountName { get; set; } + public System.Action? ConfigureClientOptions { get; set; } + public string? ConnectionString { get; set; } + public NetEvolve.HealthChecks.Azure.Blobs.BlobClientCreationMode Mode { get; set; } + public System.Uri? ServiceUri { get; set; } + public int Timeout { get; set; } + } + public static class DependencyInjectionExtensions + { + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddBlobContainerAvailability([System.Diagnostics.CodeAnalysis.NotNull] this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, [System.Diagnostics.CodeAnalysis.NotNull] string name, System.Action? options = null, params string[] tags) { } + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddBlobServiceAvailability([System.Diagnostics.CodeAnalysis.NotNull] this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, [System.Diagnostics.CodeAnalysis.NotNull] string name, System.Action? options = null, params string[] tags) { } + } +} \ No newline at end of file diff --git a/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.Azure.Queues.PublicApi_HasNotChanged_Theory.verified.txt b/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.Azure.Queues.PublicApi_HasNotChanged_Theory.verified.txt new file mode 100644 index 0000000..ac63cb8 --- /dev/null +++ b/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.Azure.Queues.PublicApi_HasNotChanged_Theory.verified.txt @@ -0,0 +1,39 @@ +namespace NetEvolve.HealthChecks.Azure.Queues +{ + public static class DependencyInjectionExtensions + { + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddQueueClientAvailability([System.Diagnostics.CodeAnalysis.NotNull] this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, [System.Diagnostics.CodeAnalysis.NotNull] string name, System.Action? options = null, params string[] tags) { } + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddQueueServiceAvailability([System.Diagnostics.CodeAnalysis.NotNull] this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, [System.Diagnostics.CodeAnalysis.NotNull] string name, System.Action? options = null, params string[] tags) { } + } + public sealed class QueueClientAvailableOptions + { + public QueueClientAvailableOptions() { } + public string? AccountKey { get; set; } + public string? AccountName { get; set; } + public System.Action? ConfigureClientOptions { get; set; } + public string? ConnectionString { get; set; } + public NetEvolve.HealthChecks.Azure.Queues.QueueClientCreationMode Mode { get; set; } + public string? QueueName { get; set; } + public System.Uri? ServiceUri { get; set; } + public int Timeout { get; set; } + } + public enum QueueClientCreationMode + { + ServiceProvider = 0, + DefaultAzureCredentials = 1, + ConnectionString = 2, + SharedKey = 3, + AzureSasCredential = 4, + } + public sealed class QueueServiceAvailableOptions + { + public QueueServiceAvailableOptions() { } + public string? AccountKey { get; set; } + public string? AccountName { get; set; } + public System.Action? ConfigureClientOptions { get; set; } + public string? ConnectionString { get; set; } + public NetEvolve.HealthChecks.Azure.Queues.QueueClientCreationMode Mode { get; set; } + public System.Uri? ServiceUri { get; set; } + public int Timeout { get; set; } + } +} \ No newline at end of file diff --git a/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.Azure.Tables.PublicApi_HasNotChanged_Theory.verified.txt b/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.Azure.Tables.PublicApi_HasNotChanged_Theory.verified.txt new file mode 100644 index 0000000..10c5a30 --- /dev/null +++ b/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.Azure.Tables.PublicApi_HasNotChanged_Theory.verified.txt @@ -0,0 +1,39 @@ +namespace NetEvolve.HealthChecks.Azure.Tables +{ + public static class DependencyInjectionExtensions + { + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddTableClientAvailability([System.Diagnostics.CodeAnalysis.NotNull] this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, [System.Diagnostics.CodeAnalysis.NotNull] string name, System.Action? options = null, params string[] tags) { } + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddTableServiceAvailability([System.Diagnostics.CodeAnalysis.NotNull] this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, [System.Diagnostics.CodeAnalysis.NotNull] string name, System.Action? options = null, params string[] tags) { } + } + public sealed class TableClientAvailableOptions + { + public TableClientAvailableOptions() { } + public string? AccountKey { get; set; } + public string? AccountName { get; set; } + public System.Action? ConfigureClientOptions { get; set; } + public string? ConnectionString { get; set; } + public NetEvolve.HealthChecks.Azure.Tables.TableClientCreationMode Mode { get; set; } + public System.Uri? ServiceUri { get; set; } + public string? TableName { get; set; } + public int Timeout { get; set; } + } + public enum TableClientCreationMode + { + ServiceProvider = 0, + DefaultAzureCredentials = 1, + ConnectionString = 2, + SharedKey = 3, + AzureSasCredential = 4, + } + public sealed class TableServiceAvailableOptions + { + public TableServiceAvailableOptions() { } + public string? AccountKey { get; set; } + public string? AccountName { get; set; } + public System.Action? ConfigureClientOptions { get; set; } + public string? ConnectionString { get; set; } + public NetEvolve.HealthChecks.Azure.Tables.TableClientCreationMode Mode { get; set; } + public System.Uri? ServiceUri { get; set; } + public int Timeout { get; set; } + } +} \ No newline at end of file diff --git a/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.ClickHouse.PublicApi_HasNotChanged_Theory.verified.txt b/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.ClickHouse.PublicApi_HasNotChanged_Theory.verified.txt new file mode 100644 index 0000000..4c82d55 --- /dev/null +++ b/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.ClickHouse.PublicApi_HasNotChanged_Theory.verified.txt @@ -0,0 +1,14 @@ +namespace NetEvolve.HealthChecks.ClickHouse +{ + public sealed class ClickHouseOptions : NetEvolve.HealthChecks.Abstractions.ISqlCheckOptions + { + public ClickHouseOptions() { } + public string Command { get; } + public string ConnectionString { get; set; } + public int Timeout { get; set; } + } + public static class DependencyInjectionExtensions + { + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddClickHouse([System.Diagnostics.CodeAnalysis.NotNull] this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, [System.Diagnostics.CodeAnalysis.NotNull] string name, System.Action? options = null, params string[] tags) { } + } +} \ No newline at end of file diff --git a/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.MySql.Connector.PublicApi_HasNotChanged_Theory.verified.txt b/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.MySql.Connector.PublicApi_HasNotChanged_Theory.verified.txt new file mode 100644 index 0000000..ac85ddc --- /dev/null +++ b/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.MySql.Connector.PublicApi_HasNotChanged_Theory.verified.txt @@ -0,0 +1,14 @@ +namespace NetEvolve.HealthChecks.MySql.Connector +{ + public static class DependencyInjectionExtensions + { + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddMySql([System.Diagnostics.CodeAnalysis.NotNull] this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, [System.Diagnostics.CodeAnalysis.NotNull] string name, System.Action? options = null, params string[] tags) { } + } + public sealed class MySqlOptions : NetEvolve.HealthChecks.Abstractions.ISqlCheckOptions + { + public MySqlOptions() { } + public string Command { get; } + public string ConnectionString { get; set; } + public int Timeout { get; set; } + } +} \ No newline at end of file diff --git a/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.MySql.PublicApi_HasNotChanged_Theory.verified.txt b/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.MySql.PublicApi_HasNotChanged_Theory.verified.txt new file mode 100644 index 0000000..533863e --- /dev/null +++ b/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.MySql.PublicApi_HasNotChanged_Theory.verified.txt @@ -0,0 +1,14 @@ +namespace NetEvolve.HealthChecks.MySql +{ + public static class DependencyInjectionExtensions + { + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddMySql([System.Diagnostics.CodeAnalysis.NotNull] this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, [System.Diagnostics.CodeAnalysis.NotNull] string name, System.Action? options = null, params string[] tags) { } + } + public sealed class MySqlOptions : NetEvolve.HealthChecks.Abstractions.ISqlCheckOptions + { + public MySqlOptions() { } + public string Command { get; } + public string ConnectionString { get; set; } + public int Timeout { get; set; } + } +} \ No newline at end of file diff --git a/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.Npgsql.PublicApi_HasNotChanged_Theory.verified.txt b/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.Npgsql.PublicApi_HasNotChanged_Theory.verified.txt new file mode 100644 index 0000000..c3c0e63 --- /dev/null +++ b/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.Npgsql.PublicApi_HasNotChanged_Theory.verified.txt @@ -0,0 +1,14 @@ +namespace NetEvolve.HealthChecks.Npgsql +{ + public static class DependencyInjectionExtensions + { + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddPostgreSql([System.Diagnostics.CodeAnalysis.NotNull] this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, [System.Diagnostics.CodeAnalysis.NotNull] string name, System.Action? options = null, params string[] tags) { } + } + public sealed class NpgsqlOptions : NetEvolve.HealthChecks.Abstractions.ISqlCheckOptions + { + public NpgsqlOptions() { } + public string Command { get; } + public string ConnectionString { get; set; } + public int Timeout { get; set; } + } +} \ No newline at end of file diff --git a/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.Oracle.PublicApi_HasNotChanged_Theory.verified.txt b/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.Oracle.PublicApi_HasNotChanged_Theory.verified.txt new file mode 100644 index 0000000..374caa8 --- /dev/null +++ b/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.Oracle.PublicApi_HasNotChanged_Theory.verified.txt @@ -0,0 +1,14 @@ +namespace NetEvolve.HealthChecks.Oracle +{ + public static class DependencyInjectionExtensions + { + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddOracle([System.Diagnostics.CodeAnalysis.NotNull] this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, [System.Diagnostics.CodeAnalysis.NotNull] string name, System.Action? options = null, params string[] tags) { } + } + public sealed class OracleOptions : NetEvolve.HealthChecks.Abstractions.ISqlCheckOptions + { + public OracleOptions() { } + public string Command { get; } + public string ConnectionString { get; set; } + public int Timeout { get; set; } + } +} \ No newline at end of file diff --git a/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.PublicApi_HasNotChanged_Theory.verified.txt b/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.PublicApi_HasNotChanged_Theory.verified.txt new file mode 100644 index 0000000..b962245 --- /dev/null +++ b/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.PublicApi_HasNotChanged_Theory.verified.txt @@ -0,0 +1,8 @@ +namespace NetEvolve.HealthChecks +{ + public static class DependencyInjectionExtensions + { + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddApplicationHealthy([System.Diagnostics.CodeAnalysis.NotNull] this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, params string[] tags) { } + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddApplicationReady([System.Diagnostics.CodeAnalysis.NotNull] this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, params string[] tags) { } + } +} \ No newline at end of file diff --git a/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.Redis.PublicApi_HasNotChanged_Theory.verified.txt b/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.Redis.PublicApi_HasNotChanged_Theory.verified.txt new file mode 100644 index 0000000..a9cd11f --- /dev/null +++ b/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.Redis.PublicApi_HasNotChanged_Theory.verified.txt @@ -0,0 +1,19 @@ +namespace NetEvolve.HealthChecks.Redis +{ + public enum ConnectionHandleMode + { + ServiceProvider = 0, + Create = 1, + } + public static class DependencyInjectionExtensions + { + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddRedisDatabase(this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, string name, System.Action? options = null, params string[] tags) { } + } + public class RedisDatabaseOptions + { + public RedisDatabaseOptions() { } + public string? ConnectionString { get; set; } + public NetEvolve.HealthChecks.Redis.ConnectionHandleMode Mode { get; set; } + public int Timeout { get; set; } + } +} \ No newline at end of file diff --git a/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.Redpanda.PublicApi_HasNotChanged_Theory.verified.txt b/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.Redpanda.PublicApi_HasNotChanged_Theory.verified.txt new file mode 100644 index 0000000..2c5f83b --- /dev/null +++ b/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.Redpanda.PublicApi_HasNotChanged_Theory.verified.txt @@ -0,0 +1,20 @@ +namespace NetEvolve.HealthChecks.Redpanda +{ + public static class DependencyInjectionExtensions + { + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddRedpanda([System.Diagnostics.CodeAnalysis.NotNull] this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, [System.Diagnostics.CodeAnalysis.NotNull] string name, System.Action? options = null, params string[] tags) { } + } + public enum ProducerHandleMode + { + ServiceProvider = 0, + Create = 1, + } + public class RedpandaOptions + { + public RedpandaOptions() { } + public Confluent.Kafka.ProducerConfig Configuration { get; set; } + public NetEvolve.HealthChecks.Redpanda.ProducerHandleMode Mode { get; set; } + public int Timeout { get; set; } + public string Topic { get; set; } + } +} \ No newline at end of file diff --git a/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.SQLite.PublicApi_HasNotChanged_Theory.verified.txt b/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.SQLite.PublicApi_HasNotChanged_Theory.verified.txt new file mode 100644 index 0000000..eb5dbb5 --- /dev/null +++ b/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.SQLite.PublicApi_HasNotChanged_Theory.verified.txt @@ -0,0 +1,14 @@ +namespace NetEvolve.HealthChecks.SQLite +{ + public static class DependencyInjectionExtensions + { + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddSQLite([System.Diagnostics.CodeAnalysis.NotNull] this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, [System.Diagnostics.CodeAnalysis.NotNull] string name, System.Action? options = null, params string[] tags) { } + } + public sealed class SQLiteOptions : NetEvolve.HealthChecks.Abstractions.ISqlCheckOptions + { + public SQLiteOptions() { } + public string Command { get; } + public string ConnectionString { get; set; } + public int Timeout { get; set; } + } +} \ No newline at end of file diff --git a/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.SqlServer.Legacy.PublicApi_HasNotChanged_Theory.verified.txt b/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.SqlServer.Legacy.PublicApi_HasNotChanged_Theory.verified.txt new file mode 100644 index 0000000..bfc08fd --- /dev/null +++ b/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.SqlServer.Legacy.PublicApi_HasNotChanged_Theory.verified.txt @@ -0,0 +1,14 @@ +namespace NetEvolve.HealthChecks.SqlServer.Legacy +{ + public static class DependencyInjectionExtensions + { + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddSqlServerLegacy([System.Diagnostics.CodeAnalysis.NotNull] this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, [System.Diagnostics.CodeAnalysis.NotNull] string name, System.Action? options = null, params string[] tags) { } + } + public sealed class SqlServerLegacyOptions : NetEvolve.HealthChecks.Abstractions.ISqlCheckOptions + { + public SqlServerLegacyOptions() { } + public string Command { get; } + public string ConnectionString { get; set; } + public int Timeout { get; set; } + } +} \ No newline at end of file diff --git a/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.SqlServer.PublicApi_HasNotChanged_Theory.verified.txt b/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.SqlServer.PublicApi_HasNotChanged_Theory.verified.txt new file mode 100644 index 0000000..9559627 --- /dev/null +++ b/tests/NetEvolve.HealthChecks.Tests.Integration/_snapshots/NetEvolve.HealthChecks.SqlServer.PublicApi_HasNotChanged_Theory.verified.txt @@ -0,0 +1,14 @@ +namespace NetEvolve.HealthChecks.SqlServer +{ + public static class DependencyInjectionExtensions + { + public static Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder AddSqlServer([System.Diagnostics.CodeAnalysis.NotNull] this Microsoft.Extensions.DependencyInjection.IHealthChecksBuilder builder, [System.Diagnostics.CodeAnalysis.NotNull] string name, System.Action? options = null, params string[] tags) { } + } + public sealed class SqlServerOptions : NetEvolve.HealthChecks.Abstractions.ISqlCheckOptions + { + public SqlServerOptions() { } + public string Command { get; } + public string ConnectionString { get; set; } + public int Timeout { get; set; } + } +} \ No newline at end of file From cfd45bb007e1b0c27ec739b4b22d381ad845728a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20St=C3=BChmer?= Date: Thu, 19 Dec 2024 09:26:59 +0100 Subject: [PATCH 2/2] fix: Add direct reference --- .../HealthCheckArchitecture.cs | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/tests/NetEvolve.HealthChecks.Tests.Architecture/HealthCheckArchitecture.cs b/tests/NetEvolve.HealthChecks.Tests.Architecture/HealthCheckArchitecture.cs index a546460..8646c7f 100644 --- a/tests/NetEvolve.HealthChecks.Tests.Architecture/HealthCheckArchitecture.cs +++ b/tests/NetEvolve.HealthChecks.Tests.Architecture/HealthCheckArchitecture.cs @@ -17,15 +17,24 @@ internal static class HealthCheckArchitecture private static Architecture LoadArchitecture() { - var assemblies = System - .Reflection.Assembly.GetExecutingAssembly()! - .GetReferencedAssemblies() - .Where(a => - a.Name?.StartsWith("NetEvolve.HealthChecks", StringComparison.OrdinalIgnoreCase) - == true - ) - .Select(System.Reflection.Assembly.Load) - .ToArray(); + System.Reflection.Assembly[] assemblies = + [ + typeof(Apache.Kafka.KafkaCheck).Assembly, + typeof(Azure.Blobs.BlobContainerAvailableHealthCheck).Assembly, + typeof(Azure.Queues.QueueClientAvailableHealthCheck).Assembly, + typeof(Azure.Tables.TableClientAvailableHealthCheck).Assembly, + typeof(ClickHouse.ClickHouseCheck).Assembly, + typeof(Dapr.DaprHealthCheck).Assembly, + typeof(MySql.MySqlCheck).Assembly, + typeof(MySql.Connector.MySqlCheck).Assembly, + typeof(Npgsql.NpgsqlCheck).Assembly, + typeof(Oracle.OracleCheck).Assembly, + typeof(Redis.RedisDatabaseHealthCheck).Assembly, + typeof(Redpanda.RedpandaCheck).Assembly, + typeof(SQLite.SQLiteCheck).Assembly, + typeof(SqlServer.SqlServerCheck).Assembly, + typeof(SqlServer.Legacy.SqlServerLegacyCheck).Assembly, + ]; return new ArchLoader() .LoadAssembliesRecursively(