Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: verify public API #212

Merged
merged 2 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 18 additions & 58 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,63 +1,23 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto

###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
*.md text eol=lf
*.js text eol=lf
*.json text eol=lf
*.yml text eol=lf
*.yaml text eol=lf
*.xml text eol=lf

###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
*.cs text eol=crlf diff=csharp
*.tt text eol=crlf
*.csproj text eol=crlf
*.props text eol=crlf
*.targets text eol=crlf
.editorconfig text eol=crlf

###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
*.png binary
*.gif binary
*.jpg binary
*.jpeg binary

###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
*.received.* text eol=lf
*.verified.* text eol=lf
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ jobs:

# Run all tests
- run: dotnet test --no-restore --no-build -c Release -- xUnit.AppDomain=denied
if: matrix.os == 'ubuntu-latest'
- run: dotnet test --no-restore --no-build -c Release --filter Category!=PublicApi -- xUnit.AppDomain=denied
if: matrix.os != 'ubuntu-latest'

pack:
needs:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,6 @@ jobs:
run: |
dotnet sonarscanner begin /k:"$SONAR_PROJECT_KEY" /o:"$SONAR_ORG_KEY" /d:sonar.host.url=https://sonarcloud.io /d:sonar.token="$SONAR_TOKEN" /d:sonar.cs.opencover.reportsPaths="**/*opencover.xml" $SONAR_PR_ARGS

dotnet test -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:ExcludeByFile="test/**/*.cs" -- xUnit.AppDomain=denied
dotnet test -c Release /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:ExcludeByFile="test/**/*.cs" /p:VerifyPublicApi=false -- xUnit.AppDomain=denied

dotnet sonarscanner end /d:sonar.token="$SONAR_TOKEN"
15 changes: 15 additions & 0 deletions test/IbanNet.DataAnnotations.Tests/PublicApi/.NET_6.0.verified.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[assembly: System.CLSCompliant(true)]
[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/skwasjer/IbanNet")]
[assembly: System.Resources.NeutralResourcesLanguage("en")]
[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName=".NET 6.0")]
namespace IbanNet.DataAnnotations
{
[System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Parameter)]
public sealed class IbanAttribute : System.ComponentModel.DataAnnotations.ValidationAttribute
{
public IbanAttribute() { }
public override bool RequiresValidationContext { get; }
public bool Strict { get; init; }
protected override System.ComponentModel.DataAnnotations.ValidationResult? IsValid(object? value, System.ComponentModel.DataAnnotations.ValidationContext validationContext) { }
}
}
15 changes: 15 additions & 0 deletions test/IbanNet.DataAnnotations.Tests/PublicApi/.NET_8.0.verified.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[assembly: System.CLSCompliant(true)]
[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/skwasjer/IbanNet")]
[assembly: System.Resources.NeutralResourcesLanguage("en")]
[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName=".NET 8.0")]
namespace IbanNet.DataAnnotations
{
[System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Parameter)]
public sealed class IbanAttribute : System.ComponentModel.DataAnnotations.ValidationAttribute
{
public IbanAttribute() { }
public override bool RequiresValidationContext { get; }
public bool Strict { get; init; }
protected override System.ComponentModel.DataAnnotations.ValidationResult? IsValid(object? value, System.ComponentModel.DataAnnotations.ValidationContext validationContext) { }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[assembly: System.CLSCompliant(true)]
[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/skwasjer/IbanNet")]
[assembly: System.Resources.NeutralResourcesLanguage("en")]
[assembly: System.Runtime.Versioning.TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName=".NET Framework 4.6.2")]
namespace IbanNet.DataAnnotations
{
[System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Parameter)]
public sealed class IbanAttribute : System.ComponentModel.DataAnnotations.ValidationAttribute
{
public IbanAttribute() { }
public override bool RequiresValidationContext { get; }
public bool Strict { get; init; }
protected override System.ComponentModel.DataAnnotations.ValidationResult? IsValid(object? value, System.ComponentModel.DataAnnotations.ValidationContext validationContext) { }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[assembly: System.CLSCompliant(true)]
[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/skwasjer/IbanNet")]
[assembly: System.Resources.NeutralResourcesLanguage("en")]
[assembly: System.Runtime.Versioning.TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName=".NET Framework 4.7.2")]
namespace IbanNet.DataAnnotations
{
[System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Parameter)]
public sealed class IbanAttribute : System.ComponentModel.DataAnnotations.ValidationAttribute
{
public IbanAttribute() { }
public override bool RequiresValidationContext { get; }
public bool Strict { get; init; }
protected override System.ComponentModel.DataAnnotations.ValidationResult? IsValid(object? value, System.ComponentModel.DataAnnotations.ValidationContext validationContext) { }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[assembly: System.CLSCompliant(true)]
[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/skwasjer/IbanNet")]
[assembly: System.Resources.NeutralResourcesLanguage("en")]
[assembly: System.Runtime.Versioning.TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName=".NET Standard 2.0")]
namespace IbanNet.DataAnnotations
{
[System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Parameter)]
public sealed class IbanAttribute : System.ComponentModel.DataAnnotations.ValidationAttribute
{
public IbanAttribute() { }
public override bool RequiresValidationContext { get; }
public bool Strict { get; init; }
protected override System.ComponentModel.DataAnnotations.ValidationResult? IsValid(object? value, System.ComponentModel.DataAnnotations.ValidationContext validationContext) { }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[assembly: System.CLSCompliant(true)]
[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/skwasjer/IbanNet")]
[assembly: System.Resources.NeutralResourcesLanguage("en")]
[assembly: System.Runtime.Versioning.TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName=".NET Standard 2.1")]
namespace IbanNet.DataAnnotations
{
[System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Parameter)]
public sealed class IbanAttribute : System.ComponentModel.DataAnnotations.ValidationAttribute
{
public IbanAttribute() { }
public override bool RequiresValidationContext { get; }
public bool Strict { get; init; }
protected override System.ComponentModel.DataAnnotations.ValidationResult? IsValid(object? value, System.ComponentModel.DataAnnotations.ValidationContext validationContext) { }
}
}
11 changes: 11 additions & 0 deletions test/IbanNet.DataAnnotations.Tests/PublicApiTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using TestHelpers.Specs;

namespace IbanNet.DataAnnotations;

public sealed class PublicApiTests : PublicApiSpec
{
public PublicApiTests()
: base(typeof(IbanAttribute))
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/skwasjer/IbanNet")]
[assembly: System.Resources.NeutralResourcesLanguage("en")]
[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName=".NET 6.0")]
namespace IbanNet.DependencyInjection.Autofac
{
public static class AutofacRegistrationExtensions
{
public static Autofac.ContainerBuilder RegisterIbanNet(this Autofac.ContainerBuilder containerBuilder, bool preserveStaticValidator = false) { }
public static Autofac.ContainerBuilder RegisterIbanNet(this Autofac.ContainerBuilder containerBuilder, System.Action<IbanNet.DependencyInjection.IIbanNetOptionsBuilder> configure, bool preserveStaticValidator = false) { }
}
public static class IbanNetOptionsBuilderExtensions
{
public static IbanNet.DependencyInjection.IIbanNetOptionsBuilder Configure(this IbanNet.DependencyInjection.IIbanNetOptionsBuilder builder, System.Action<Autofac.IComponentContext, IbanNet.IbanValidatorOptions> configure) { }
public static IbanNet.DependencyInjection.IIbanNetOptionsBuilder WithRule<T>(this IbanNet.DependencyInjection.IIbanNetOptionsBuilder builder, System.Func<Autofac.IComponentContext, T> implementationFactory)
where T : class, IbanNet.Validation.Rules.IIbanValidationRule { }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/skwasjer/IbanNet")]
[assembly: System.Resources.NeutralResourcesLanguage("en")]
[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName=".NET 8.0")]
namespace IbanNet.DependencyInjection.Autofac
{
public static class AutofacRegistrationExtensions
{
public static Autofac.ContainerBuilder RegisterIbanNet(this Autofac.ContainerBuilder containerBuilder, bool preserveStaticValidator = false) { }
public static Autofac.ContainerBuilder RegisterIbanNet(this Autofac.ContainerBuilder containerBuilder, System.Action<IbanNet.DependencyInjection.IIbanNetOptionsBuilder> configure, bool preserveStaticValidator = false) { }
}
public static class IbanNetOptionsBuilderExtensions
{
public static IbanNet.DependencyInjection.IIbanNetOptionsBuilder Configure(this IbanNet.DependencyInjection.IIbanNetOptionsBuilder builder, System.Action<Autofac.IComponentContext, IbanNet.IbanValidatorOptions> configure) { }
public static IbanNet.DependencyInjection.IIbanNetOptionsBuilder WithRule<T>(this IbanNet.DependencyInjection.IIbanNetOptionsBuilder builder, System.Func<Autofac.IComponentContext, T> implementationFactory)
where T : class, IbanNet.Validation.Rules.IIbanValidationRule { }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/skwasjer/IbanNet")]
[assembly: System.Resources.NeutralResourcesLanguage("en")]
[assembly: System.Runtime.Versioning.TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName=".NET Standard 2.0")]
namespace IbanNet.DependencyInjection.Autofac
{
public static class AutofacRegistrationExtensions
{
public static Autofac.ContainerBuilder RegisterIbanNet(this Autofac.ContainerBuilder containerBuilder, bool preserveStaticValidator = false) { }
public static Autofac.ContainerBuilder RegisterIbanNet(this Autofac.ContainerBuilder containerBuilder, System.Action<IbanNet.DependencyInjection.IIbanNetOptionsBuilder> configure, bool preserveStaticValidator = false) { }
}
public static class IbanNetOptionsBuilderExtensions
{
public static IbanNet.DependencyInjection.IIbanNetOptionsBuilder Configure(this IbanNet.DependencyInjection.IIbanNetOptionsBuilder builder, System.Action<Autofac.IComponentContext, IbanNet.IbanValidatorOptions> configure) { }
public static IbanNet.DependencyInjection.IIbanNetOptionsBuilder WithRule<T>(this IbanNet.DependencyInjection.IIbanNetOptionsBuilder builder, System.Func<Autofac.IComponentContext, T> implementationFactory)
where T : class, IbanNet.Validation.Rules.IIbanValidationRule { }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/skwasjer/IbanNet")]
[assembly: System.Resources.NeutralResourcesLanguage("en")]
[assembly: System.Runtime.Versioning.TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName=".NET Standard 2.1")]
namespace IbanNet.DependencyInjection.Autofac
{
public static class AutofacRegistrationExtensions
{
public static Autofac.ContainerBuilder RegisterIbanNet(this Autofac.ContainerBuilder containerBuilder, bool preserveStaticValidator = false) { }
public static Autofac.ContainerBuilder RegisterIbanNet(this Autofac.ContainerBuilder containerBuilder, System.Action<IbanNet.DependencyInjection.IIbanNetOptionsBuilder> configure, bool preserveStaticValidator = false) { }
}
public static class IbanNetOptionsBuilderExtensions
{
public static IbanNet.DependencyInjection.IIbanNetOptionsBuilder Configure(this IbanNet.DependencyInjection.IIbanNetOptionsBuilder builder, System.Action<Autofac.IComponentContext, IbanNet.IbanValidatorOptions> configure) { }
public static IbanNet.DependencyInjection.IIbanNetOptionsBuilder WithRule<T>(this IbanNet.DependencyInjection.IIbanNetOptionsBuilder builder, System.Func<Autofac.IComponentContext, T> implementationFactory)
where T : class, IbanNet.Validation.Rules.IIbanValidationRule { }
}
}
11 changes: 11 additions & 0 deletions test/IbanNet.DependencyInjection.Autofac.Tests/PublicApiTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using TestHelpers.Specs;

namespace IbanNet.DependencyInjection.Autofac;

public sealed class PublicApiTests : PublicApiSpec
{
public PublicApiTests()
: base(typeof(AutofacRegistrationExtensions))
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[assembly: System.CLSCompliant(true)]
[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/skwasjer/IbanNet")]
[assembly: System.Resources.NeutralResourcesLanguage("en")]
[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName=".NET 6.0")]
namespace IbanNet.DependencyInjection.ServiceProvider
{
public static class IbanNetOptionsBuilderExtensions
{
public static IbanNet.DependencyInjection.IIbanNetOptionsBuilder Configure(this IbanNet.DependencyInjection.IIbanNetOptionsBuilder builder, System.Action<System.IServiceProvider, IbanNet.IbanValidatorOptions> configure) { }
public static IbanNet.DependencyInjection.IIbanNetOptionsBuilder WithRule<T>(this IbanNet.DependencyInjection.IIbanNetOptionsBuilder builder, System.Func<System.IServiceProvider, T> implementationFactory)
where T : class, IbanNet.Validation.Rules.IIbanValidationRule { }
}
public static class ServiceCollectionExtensions
{
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddIbanNet(this Microsoft.Extensions.DependencyInjection.IServiceCollection services) { }
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddIbanNet(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Action<IbanNet.DependencyInjection.IIbanNetOptionsBuilder> configure) { }
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddIbanNet(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, bool preserveStaticValidator) { }
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddIbanNet(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Action<IbanNet.DependencyInjection.IIbanNetOptionsBuilder> configure, bool preserveStaticValidator) { }
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[assembly: System.CLSCompliant(true)]
[assembly: System.Reflection.AssemblyMetadata("RepositoryUrl", "https://github.com/skwasjer/IbanNet")]
[assembly: System.Resources.NeutralResourcesLanguage("en")]
[assembly: System.Runtime.Versioning.TargetFramework(".NETCoreApp,Version=v8.0", FrameworkDisplayName=".NET 8.0")]
namespace IbanNet.DependencyInjection.ServiceProvider
{
public static class IbanNetOptionsBuilderExtensions
{
public static IbanNet.DependencyInjection.IIbanNetOptionsBuilder Configure(this IbanNet.DependencyInjection.IIbanNetOptionsBuilder builder, System.Action<System.IServiceProvider, IbanNet.IbanValidatorOptions> configure) { }
public static IbanNet.DependencyInjection.IIbanNetOptionsBuilder WithRule<T>(this IbanNet.DependencyInjection.IIbanNetOptionsBuilder builder, System.Func<System.IServiceProvider, T> implementationFactory)
where T : class, IbanNet.Validation.Rules.IIbanValidationRule { }
}
public static class ServiceCollectionExtensions
{
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddIbanNet(this Microsoft.Extensions.DependencyInjection.IServiceCollection services) { }
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddIbanNet(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Action<IbanNet.DependencyInjection.IIbanNetOptionsBuilder> configure) { }
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddIbanNet(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, bool preserveStaticValidator) { }
public static Microsoft.Extensions.DependencyInjection.IServiceCollection AddIbanNet(this Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Action<IbanNet.DependencyInjection.IIbanNetOptionsBuilder> configure, bool preserveStaticValidator) { }
}
}
Loading
Loading