diff --git a/docs/docs/contributing/common-tasks.md b/docs/docs/contributing/common-tasks.md index 1f027f76b1..297ee4c1fd 100644 --- a/docs/docs/contributing/common-tasks.md +++ b/docs/docs/contributing/common-tasks.md @@ -25,9 +25,9 @@ as it is generated automatically on the basis of the `AnalyzerReleases.Shipped.m ## New public API -If new public API surface is introduced in `Riok.Mapperly.Abstractions`, -add the new API to the `PublicAPI.Shipped.txt` file directly. -Mapperly does not use the `PublicAPI.Unshipped.txt` file. +If new public API surface is introduced in `Riok.Mapperly.Abstractions` or existing API surface is modified, +the `PublicApiTest` snapshot test needs to be updated. +See also [VerifyTests](./tests.md#verifytests). ## Add support for a new roslyn version diff --git a/src/Riok.Mapperly.Abstractions/PublicAPI.Shipped.txt b/src/Riok.Mapperly.Abstractions/PublicAPI.Shipped.txt deleted file mode 100644 index f40e11a59d..0000000000 --- a/src/Riok.Mapperly.Abstractions/PublicAPI.Shipped.txt +++ /dev/null @@ -1,190 +0,0 @@ -#nullable enable - -Riok.Mapperly.Abstractions.EnumMappingStrategy -Riok.Mapperly.Abstractions.EnumMappingStrategy.ByName = 1 -> Riok.Mapperly.Abstractions.EnumMappingStrategy -Riok.Mapperly.Abstractions.EnumMappingStrategy.ByValue = 0 -> Riok.Mapperly.Abstractions.EnumMappingStrategy -Riok.Mapperly.Abstractions.IgnoreObsoleteMembersStrategy -Riok.Mapperly.Abstractions.IgnoreObsoleteMembersStrategy.Both = -1 -> Riok.Mapperly.Abstractions.IgnoreObsoleteMembersStrategy -Riok.Mapperly.Abstractions.IgnoreObsoleteMembersStrategy.None = 0 -> Riok.Mapperly.Abstractions.IgnoreObsoleteMembersStrategy -Riok.Mapperly.Abstractions.IgnoreObsoleteMembersStrategy.Source = 1 -> Riok.Mapperly.Abstractions.IgnoreObsoleteMembersStrategy -Riok.Mapperly.Abstractions.IgnoreObsoleteMembersStrategy.Target = 2 -> Riok.Mapperly.Abstractions.IgnoreObsoleteMembersStrategy -Riok.Mapperly.Abstractions.MapEnumAttribute -Riok.Mapperly.Abstractions.MapEnumAttribute.IgnoreCase.get -> bool -Riok.Mapperly.Abstractions.MapEnumAttribute.IgnoreCase.set -> void -Riok.Mapperly.Abstractions.MapEnumAttribute.MapEnumAttribute(Riok.Mapperly.Abstractions.EnumMappingStrategy strategy) -> void -Riok.Mapperly.Abstractions.MapEnumAttribute.Strategy.get -> Riok.Mapperly.Abstractions.EnumMappingStrategy -Riok.Mapperly.Abstractions.MapEnumValueAttribute -Riok.Mapperly.Abstractions.MapEnumValueAttribute.MapEnumValueAttribute(object! source, object! target) -> void -Riok.Mapperly.Abstractions.MapperAttribute -Riok.Mapperly.Abstractions.MapperAttribute.EnabledConversions.get -> Riok.Mapperly.Abstractions.MappingConversionType -Riok.Mapperly.Abstractions.MapperAttribute.EnabledConversions.set -> void -Riok.Mapperly.Abstractions.MapperAttribute.EnumMappingIgnoreCase.get -> bool -Riok.Mapperly.Abstractions.MapperAttribute.EnumMappingIgnoreCase.set -> void -Riok.Mapperly.Abstractions.MapperAttribute.EnumMappingStrategy.get -> Riok.Mapperly.Abstractions.EnumMappingStrategy -Riok.Mapperly.Abstractions.MapperAttribute.EnumMappingStrategy.set -> void -Riok.Mapperly.Abstractions.MapperAttribute.IgnoreObsoleteMembersStrategy.get -> Riok.Mapperly.Abstractions.IgnoreObsoleteMembersStrategy -Riok.Mapperly.Abstractions.MapperAttribute.IgnoreObsoleteMembersStrategy.set -> void -Riok.Mapperly.Abstractions.MapperAttribute.MapperAttribute() -> void -Riok.Mapperly.Abstractions.MapperAttribute.PropertyNameMappingStrategy.get -> Riok.Mapperly.Abstractions.PropertyNameMappingStrategy -Riok.Mapperly.Abstractions.MapperAttribute.PropertyNameMappingStrategy.set -> void -Riok.Mapperly.Abstractions.MapperAttribute.ThrowOnMappingNullMismatch.get -> bool -Riok.Mapperly.Abstractions.MapperAttribute.ThrowOnMappingNullMismatch.set -> void -Riok.Mapperly.Abstractions.MapperAttribute.ThrowOnPropertyMappingNullMismatch.get -> bool -Riok.Mapperly.Abstractions.MapperAttribute.ThrowOnPropertyMappingNullMismatch.set -> void -Riok.Mapperly.Abstractions.MapperAttribute.UseDeepCloning.get -> bool -Riok.Mapperly.Abstractions.MapperAttribute.UseDeepCloning.set -> void -Riok.Mapperly.Abstractions.MapperDefaultsAttribute -Riok.Mapperly.Abstractions.MapperDefaultsAttribute.MapperDefaultsAttribute() -> void -Riok.Mapperly.Abstractions.MapperConstructorAttribute -Riok.Mapperly.Abstractions.MapperConstructorAttribute.MapperConstructorAttribute() -> void -Riok.Mapperly.Abstractions.MapperIgnoreObsoleteMembersAttribute -Riok.Mapperly.Abstractions.MapperIgnoreObsoleteMembersAttribute.IgnoreObsoleteStrategy.get -> Riok.Mapperly.Abstractions.IgnoreObsoleteMembersStrategy -Riok.Mapperly.Abstractions.MapperIgnoreObsoleteMembersAttribute.MapperIgnoreObsoleteMembersAttribute(Riok.Mapperly.Abstractions.IgnoreObsoleteMembersStrategy ignoreObsoleteStrategy = (Riok.Mapperly.Abstractions.IgnoreObsoleteMembersStrategy)-1) -> void -Riok.Mapperly.Abstractions.MapperIgnoreAttribute -Riok.Mapperly.Abstractions.MapperIgnoreAttribute.MapperIgnoreAttribute() -> void -Riok.Mapperly.Abstractions.MapperIgnoreSourceAttribute -Riok.Mapperly.Abstractions.MapperIgnoreSourceAttribute.MapperIgnoreSourceAttribute(string! source) -> void -Riok.Mapperly.Abstractions.MapperIgnoreSourceAttribute.Source.get -> string! -Riok.Mapperly.Abstractions.MapperIgnoreTargetAttribute -Riok.Mapperly.Abstractions.MapperIgnoreTargetAttribute.MapperIgnoreTargetAttribute(string! target) -> void -Riok.Mapperly.Abstractions.MapperIgnoreTargetAttribute.Target.get -> string! -Riok.Mapperly.Abstractions.MapPropertyAttribute -Riok.Mapperly.Abstractions.MapPropertyAttribute.MapPropertyAttribute(string! source, string! target) -> void -Riok.Mapperly.Abstractions.MapPropertyAttribute.MapPropertyAttribute(string![]! source, string![]! target) -> void -Riok.Mapperly.Abstractions.MapPropertyAttribute.Source.get -> System.Collections.Generic.IReadOnlyCollection! -Riok.Mapperly.Abstractions.MapPropertyAttribute.SourceFullName.get -> string! -Riok.Mapperly.Abstractions.MapPropertyAttribute.Target.get -> System.Collections.Generic.IReadOnlyCollection! -Riok.Mapperly.Abstractions.MapPropertyAttribute.TargetFullName.get -> string! -Riok.Mapperly.Abstractions.MapPropertyAttribute.StringFormat.get -> string? -Riok.Mapperly.Abstractions.MapPropertyAttribute.StringFormat.set -> void -Riok.Mapperly.Abstractions.ObjectFactoryAttribute -Riok.Mapperly.Abstractions.ObjectFactoryAttribute.ObjectFactoryAttribute() -> void -Riok.Mapperly.Abstractions.PropertyNameMappingStrategy -Riok.Mapperly.Abstractions.PropertyNameMappingStrategy.CaseInsensitive = 1 -> Riok.Mapperly.Abstractions.PropertyNameMappingStrategy -Riok.Mapperly.Abstractions.PropertyNameMappingStrategy.CaseSensitive = 0 -> Riok.Mapperly.Abstractions.PropertyNameMappingStrategy -Riok.Mapperly.Abstractions.MappingConversionType -Riok.Mapperly.Abstractions.MappingConversionType.All = -1 -> Riok.Mapperly.Abstractions.MappingConversionType -Riok.Mapperly.Abstractions.MappingConversionType.Constructor = 1 -> Riok.Mapperly.Abstractions.MappingConversionType -Riok.Mapperly.Abstractions.MappingConversionType.DateTimeToDateOnly = 256 -> Riok.Mapperly.Abstractions.MappingConversionType -Riok.Mapperly.Abstractions.MappingConversionType.DateTimeToTimeOnly = 512 -> Riok.Mapperly.Abstractions.MappingConversionType -Riok.Mapperly.Abstractions.MappingConversionType.Dictionary = 4096 -> Riok.Mapperly.Abstractions.MappingConversionType -Riok.Mapperly.Abstractions.MappingConversionType.Enumerable = 2048 -> Riok.Mapperly.Abstractions.MappingConversionType -Riok.Mapperly.Abstractions.MappingConversionType.EnumToEnum = 128 -> Riok.Mapperly.Abstractions.MappingConversionType -Riok.Mapperly.Abstractions.MappingConversionType.EnumToString = 64 -> Riok.Mapperly.Abstractions.MappingConversionType -Riok.Mapperly.Abstractions.MappingConversionType.ExplicitCast = 4 -> Riok.Mapperly.Abstractions.MappingConversionType -Riok.Mapperly.Abstractions.MappingConversionType.ImplicitCast = 2 -> Riok.Mapperly.Abstractions.MappingConversionType -Riok.Mapperly.Abstractions.MappingConversionType.Memory = 16384 -> Riok.Mapperly.Abstractions.MappingConversionType -Riok.Mapperly.Abstractions.MappingConversionType.None = 0 -> Riok.Mapperly.Abstractions.MappingConversionType -Riok.Mapperly.Abstractions.MappingConversionType.ParseMethod = 8 -> Riok.Mapperly.Abstractions.MappingConversionType -Riok.Mapperly.Abstractions.MappingConversionType.Span = 8192 -> Riok.Mapperly.Abstractions.MappingConversionType -Riok.Mapperly.Abstractions.MappingConversionType.StringToEnum = 32 -> Riok.Mapperly.Abstractions.MappingConversionType -Riok.Mapperly.Abstractions.MappingConversionType.ToStringMethod = 16 -> Riok.Mapperly.Abstractions.MappingConversionType -Riok.Mapperly.Abstractions.MappingConversionType.Tuple = 32768 -> Riok.Mapperly.Abstractions.MappingConversionType -Riok.Mapperly.Abstractions.MappingConversionType.Queryable = 1024 -> Riok.Mapperly.Abstractions.MappingConversionType -Riok.Mapperly.Abstractions.MappingConversionType.EnumUnderlyingType = 65536 -> Riok.Mapperly.Abstractions.MappingConversionType -Riok.Mapperly.Abstractions.MapperAttribute.UseReferenceHandling.get -> bool -Riok.Mapperly.Abstractions.MapperAttribute.UseReferenceHandling.set -> void -Riok.Mapperly.Abstractions.ReferenceHandling.IReferenceHandler -Riok.Mapperly.Abstractions.ReferenceHandling.IReferenceHandler.SetReference(TSource source, TTarget target) -> void -Riok.Mapperly.Abstractions.ReferenceHandling.IReferenceHandler.TryGetReference(TSource source, out TTarget? target) -> bool -Riok.Mapperly.Abstractions.ReferenceHandling.ReferenceHandlerAttribute -Riok.Mapperly.Abstractions.ReferenceHandling.ReferenceHandlerAttribute.ReferenceHandlerAttribute() -> void -Riok.Mapperly.Abstractions.MapDerivedTypeAttribute -Riok.Mapperly.Abstractions.MapDerivedTypeAttribute.MapDerivedTypeAttribute() -> void -Riok.Mapperly.Abstractions.MapDerivedTypeAttribute -Riok.Mapperly.Abstractions.MapDerivedTypeAttribute.MapDerivedTypeAttribute(System.Type! sourceType, System.Type! targetType) -> void -Riok.Mapperly.Abstractions.MapDerivedTypeAttribute.SourceType.get -> System.Type! -Riok.Mapperly.Abstractions.MapDerivedTypeAttribute.TargetType.get -> System.Type! -Riok.Mapperly.Abstractions.EnumMappingStrategy.ByValueCheckDefined = 2 -> Riok.Mapperly.Abstractions.EnumMappingStrategy -Riok.Mapperly.Abstractions.MapEnumAttribute.FallbackValue.get -> object? -Riok.Mapperly.Abstractions.MapEnumAttribute.FallbackValue.set -> void -Riok.Mapperly.Abstractions.MapperIgnoreSourceValueAttribute -Riok.Mapperly.Abstractions.MapperIgnoreSourceValueAttribute.MapperIgnoreSourceValueAttribute(object! source) -> void -Riok.Mapperly.Abstractions.MapperIgnoreTargetValueAttribute -Riok.Mapperly.Abstractions.MapperIgnoreTargetValueAttribute.MapperIgnoreTargetValueAttribute(object! target) -> void -Riok.Mapperly.Abstractions.MapperIgnoreSourceValueAttribute.SourceValue.get -> System.Enum? -Riok.Mapperly.Abstractions.MapperIgnoreTargetValueAttribute.TargetValue.get -> System.Enum? -Riok.Mapperly.Abstractions.MapperAttribute.AllowNullPropertyAssignment.get -> bool -Riok.Mapperly.Abstractions.MapperAttribute.AllowNullPropertyAssignment.set -> void -Riok.Mapperly.Abstractions.UseMapperAttribute -Riok.Mapperly.Abstractions.UseMapperAttribute.UseMapperAttribute() -> void -Riok.Mapperly.Abstractions.UseStaticMapperAttribute -Riok.Mapperly.Abstractions.UseStaticMapperAttribute.UseStaticMapperAttribute(System.Type! mapperType) -> void -Riok.Mapperly.Abstractions.UseStaticMapperAttribute -Riok.Mapperly.Abstractions.UseStaticMapperAttribute.UseStaticMapperAttribute() -> void -Riok.Mapperly.Abstractions.MapperAttribute.RequiredMappingStrategy.get -> Riok.Mapperly.Abstractions.RequiredMappingStrategy -Riok.Mapperly.Abstractions.MapperAttribute.RequiredMappingStrategy.set -> void -Riok.Mapperly.Abstractions.MapperRequiredMappingAttribute -Riok.Mapperly.Abstractions.MapperRequiredMappingAttribute.MapperRequiredMappingAttribute(Riok.Mapperly.Abstractions.RequiredMappingStrategy requiredMappingStrategy) -> void -Riok.Mapperly.Abstractions.MapperRequiredMappingAttribute.RequiredMappingStrategy.get -> Riok.Mapperly.Abstractions.RequiredMappingStrategy -Riok.Mapperly.Abstractions.RequiredMappingStrategy -Riok.Mapperly.Abstractions.RequiredMappingStrategy.Both = -1 -> Riok.Mapperly.Abstractions.RequiredMappingStrategy -Riok.Mapperly.Abstractions.RequiredMappingStrategy.None = 0 -> Riok.Mapperly.Abstractions.RequiredMappingStrategy -Riok.Mapperly.Abstractions.RequiredMappingStrategy.Source = 1 -> Riok.Mapperly.Abstractions.RequiredMappingStrategy -Riok.Mapperly.Abstractions.RequiredMappingStrategy.Target = 2 -> Riok.Mapperly.Abstractions.RequiredMappingStrategy -Riok.Mapperly.Abstractions.MapperAttribute.IncludedMembers.get -> Riok.Mapperly.Abstractions.MemberVisibility -Riok.Mapperly.Abstractions.MapperAttribute.IncludedMembers.set -> void -Riok.Mapperly.Abstractions.MemberVisibility -Riok.Mapperly.Abstractions.MemberVisibility.Accessible = 1 -> Riok.Mapperly.Abstractions.MemberVisibility -Riok.Mapperly.Abstractions.MemberVisibility.All = Riok.Mapperly.Abstractions.MemberVisibility.Public | Riok.Mapperly.Abstractions.MemberVisibility.Internal | Riok.Mapperly.Abstractions.MemberVisibility.Protected | Riok.Mapperly.Abstractions.MemberVisibility.Private -> Riok.Mapperly.Abstractions.MemberVisibility -Riok.Mapperly.Abstractions.MemberVisibility.AllAccessible = Riok.Mapperly.Abstractions.MemberVisibility.Accessible | Riok.Mapperly.Abstractions.MemberVisibility.All -> Riok.Mapperly.Abstractions.MemberVisibility -Riok.Mapperly.Abstractions.MemberVisibility.Internal = 4 -> Riok.Mapperly.Abstractions.MemberVisibility -Riok.Mapperly.Abstractions.MemberVisibility.Private = 16 -> Riok.Mapperly.Abstractions.MemberVisibility -Riok.Mapperly.Abstractions.MemberVisibility.Protected = 8 -> Riok.Mapperly.Abstractions.MemberVisibility -Riok.Mapperly.Abstractions.MemberVisibility.Public = 2 -> Riok.Mapperly.Abstractions.MemberVisibility -Riok.Mapperly.Abstractions.FormatProviderAttribute -Riok.Mapperly.Abstractions.FormatProviderAttribute.Default.get -> bool -Riok.Mapperly.Abstractions.FormatProviderAttribute.Default.set -> void -Riok.Mapperly.Abstractions.FormatProviderAttribute.FormatProviderAttribute() -> void -Riok.Mapperly.Abstractions.MapPropertyAttribute.FormatProvider.get -> string? -Riok.Mapperly.Abstractions.MapPropertyAttribute.FormatProvider.set -> void -Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler -Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler.PreserveReferenceHandler() -> void -Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler.SetReference(TSource source, TTarget target) -> void -Riok.Mapperly.Abstractions.ReferenceHandling.PreserveReferenceHandler.TryGetReference(TSource source, out TTarget? target) -> bool -Riok.Mapperly.Abstractions.MapperAttribute.PreferParameterlessConstructors.get -> bool -Riok.Mapperly.Abstractions.MapperAttribute.PreferParameterlessConstructors.set -> void -Riok.Mapperly.Abstractions.MapperAttribute.AutoUserMappings.get -> bool -Riok.Mapperly.Abstractions.MapperAttribute.AutoUserMappings.set -> void -Riok.Mapperly.Abstractions.UserMappingAttribute -Riok.Mapperly.Abstractions.UserMappingAttribute.Ignore.get -> bool -Riok.Mapperly.Abstractions.UserMappingAttribute.Ignore.set -> void -Riok.Mapperly.Abstractions.UserMappingAttribute.UserMappingAttribute() -> void -Riok.Mapperly.Abstractions.UserMappingAttribute.Default.get -> bool -Riok.Mapperly.Abstractions.UserMappingAttribute.Default.set -> void -Riok.Mapperly.Abstractions.MapPropertyAttribute.Use.get -> string? -Riok.Mapperly.Abstractions.MapPropertyAttribute.Use.set -> void -Riok.Mapperly.Abstractions.MapNestedPropertiesAttribute -Riok.Mapperly.Abstractions.MapNestedPropertiesAttribute.MapNestedPropertiesAttribute(string! source) -> void -Riok.Mapperly.Abstractions.MapNestedPropertiesAttribute.MapNestedPropertiesAttribute(string![]! source) -> void -Riok.Mapperly.Abstractions.MapNestedPropertiesAttribute.Source.get -> System.Collections.Generic.IReadOnlyCollection! -Riok.Mapperly.Abstractions.MapNestedPropertiesAttribute.SourceFullName.get -> string! -Riok.Mapperly.Abstractions.MapPropertyFromSourceAttribute -Riok.Mapperly.Abstractions.MapPropertyFromSourceAttribute.MapPropertyFromSourceAttribute(string! target) -> void -Riok.Mapperly.Abstractions.MapPropertyFromSourceAttribute.MapPropertyFromSourceAttribute(string![]! target) -> void -Riok.Mapperly.Abstractions.MapPropertyFromSourceAttribute.Target.get -> System.Collections.Generic.IReadOnlyCollection! -Riok.Mapperly.Abstractions.MapPropertyFromSourceAttribute.TargetFullName.get -> string! -Riok.Mapperly.Abstractions.MapPropertyFromSourceAttribute.StringFormat.get -> string? -Riok.Mapperly.Abstractions.MapPropertyFromSourceAttribute.StringFormat.set -> void -Riok.Mapperly.Abstractions.MapPropertyFromSourceAttribute.FormatProvider.get -> string? -Riok.Mapperly.Abstractions.MapPropertyFromSourceAttribute.FormatProvider.set -> void -Riok.Mapperly.Abstractions.MapPropertyFromSourceAttribute.Use.get -> string? -Riok.Mapperly.Abstractions.MapPropertyFromSourceAttribute.Use.set -> void -Riok.Mapperly.Abstractions.MapValueAttribute -Riok.Mapperly.Abstractions.MapValueAttribute.Use.get -> string? -Riok.Mapperly.Abstractions.MapValueAttribute.Use.set -> void -Riok.Mapperly.Abstractions.MapValueAttribute.MapValueAttribute(string! target) -> void -Riok.Mapperly.Abstractions.MapValueAttribute.MapValueAttribute(string! target, object? value) -> void -Riok.Mapperly.Abstractions.MapValueAttribute.MapValueAttribute(string![]! target) -> void -Riok.Mapperly.Abstractions.MapValueAttribute.MapValueAttribute(string![]! target, object? value) -> void -Riok.Mapperly.Abstractions.MapValueAttribute.Target.get -> System.Collections.Generic.IReadOnlyCollection! -Riok.Mapperly.Abstractions.MapValueAttribute.TargetFullName.get -> string! -Riok.Mapperly.Abstractions.MapValueAttribute.Value.get -> object? -Riok.Mapperly.Abstractions.MappingTargetAttribute -Riok.Mapperly.Abstractions.MappingTargetAttribute.MappingTargetAttribute() -> void -Riok.Mapperly.Abstractions.MapPropertyAttribute.MapPropertyAttribute(string! source, string![]! target) -> void -Riok.Mapperly.Abstractions.MapPropertyAttribute.MapPropertyAttribute(string![]! source, string! target) -> void -Riok.Mapperly.Abstractions.MapperAttribute.IncludedConstructors.get -> Riok.Mapperly.Abstractions.MemberVisibility -Riok.Mapperly.Abstractions.MapperAttribute.IncludedConstructors.set -> void -Riok.Mapperly.Abstractions.MapEnumValueAttribute.Source.get -> object! -Riok.Mapperly.Abstractions.MapEnumValueAttribute.Target.get -> object! diff --git a/src/Riok.Mapperly.Abstractions/PublicAPI.Unshipped.txt b/src/Riok.Mapperly.Abstractions/PublicAPI.Unshipped.txt deleted file mode 100644 index 7dc5c58110..0000000000 --- a/src/Riok.Mapperly.Abstractions/PublicAPI.Unshipped.txt +++ /dev/null @@ -1 +0,0 @@ -#nullable enable diff --git a/src/Riok.Mapperly.Abstractions/Riok.Mapperly.Abstractions.csproj b/src/Riok.Mapperly.Abstractions/Riok.Mapperly.Abstractions.csproj index c55ede897d..bd0764dce0 100644 --- a/src/Riok.Mapperly.Abstractions/Riok.Mapperly.Abstractions.csproj +++ b/src/Riok.Mapperly.Abstractions/Riok.Mapperly.Abstractions.csproj @@ -8,8 +8,4 @@ - - - - diff --git a/test/Riok.Mapperly.Abstractions.Tests/ModuleInitializer.cs b/test/Riok.Mapperly.Abstractions.Tests/ModuleInitializer.cs new file mode 100644 index 0000000000..cace9b6964 --- /dev/null +++ b/test/Riok.Mapperly.Abstractions.Tests/ModuleInitializer.cs @@ -0,0 +1,17 @@ +using System.Runtime.CompilerServices; +using VerifyTests.DiffPlex; + +namespace Riok.Mapperly.Abstractions.Tests; + +public static class ModuleInitializer +{ + // ModuleInitializer should only be used in apps +#pragma warning disable CA2255 + [ModuleInitializer] +#pragma warning restore CA2255 + public static void Init() + { + DerivePathInfo((file, _, type, method) => new(Path.Join(Path.GetDirectoryName(file), "_snapshots"), type.Name, method.Name)); + VerifyDiffPlex.Initialize(OutputType.Compact); + } +} diff --git a/test/Riok.Mapperly.Abstractions.Tests/PublicApiTest.cs b/test/Riok.Mapperly.Abstractions.Tests/PublicApiTest.cs new file mode 100644 index 0000000000..4458527ae3 --- /dev/null +++ b/test/Riok.Mapperly.Abstractions.Tests/PublicApiTest.cs @@ -0,0 +1,14 @@ +using PublicApiGenerator; + +namespace Riok.Mapperly.Abstractions.Tests; + +public class PublicApiTest +{ + [Fact] + public Task PublicApiHasNotChanged() + { + var assembly = typeof(MapperAttribute).Assembly; + var api = assembly.GeneratePublicApi(); + return Verify(api, "cs"); + } +} diff --git a/test/Riok.Mapperly.Abstractions.Tests/Riok.Mapperly.Abstractions.Tests.csproj b/test/Riok.Mapperly.Abstractions.Tests/Riok.Mapperly.Abstractions.Tests.csproj index 7b06e9a287..0559eddcaa 100644 --- a/test/Riok.Mapperly.Abstractions.Tests/Riok.Mapperly.Abstractions.Tests.csproj +++ b/test/Riok.Mapperly.Abstractions.Tests/Riok.Mapperly.Abstractions.Tests.csproj @@ -6,6 +6,7 @@ + diff --git a/test/Riok.Mapperly.Abstractions.Tests/_snapshots/PublicApiTest.PublicApiHasNotChanged.verified.cs b/test/Riok.Mapperly.Abstractions.Tests/_snapshots/PublicApiTest.PublicApiHasNotChanged.verified.cs new file mode 100644 index 0000000000..da647e8fea --- /dev/null +++ b/test/Riok.Mapperly.Abstractions.Tests/_snapshots/PublicApiTest.PublicApiHasNotChanged.verified.cs @@ -0,0 +1,302 @@ +[assembly: System.Runtime.Versioning.TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName=".NET Standard 2.0")] +namespace Riok.Mapperly.Abstractions +{ + public enum EnumMappingStrategy + { + ByValue = 0, + ByName = 1, + ByValueCheckDefined = 2, + } + [System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Field)] + [System.Diagnostics.Conditional("MAPPERLY_ABSTRACTIONS_SCOPE_RUNTIME")] + public sealed class FormatProviderAttribute : System.Attribute + { + public FormatProviderAttribute() { } + public bool Default { get; set; } + } + [System.Flags] + public enum IgnoreObsoleteMembersStrategy + { + None = 0, + Both = -1, + Source = 1, + Target = 2, + } + [System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=true)] + [System.Diagnostics.Conditional("MAPPERLY_ABSTRACTIONS_SCOPE_RUNTIME")] + public sealed class MapDerivedTypeAttribute : System.Attribute + { + public MapDerivedTypeAttribute(System.Type sourceType, System.Type targetType) { } + public System.Type SourceType { get; } + public System.Type TargetType { get; } + } + [System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=true)] + [System.Diagnostics.Conditional("MAPPERLY_ABSTRACTIONS_SCOPE_RUNTIME")] + public sealed class MapDerivedTypeAttribute : System.Attribute + { + public MapDerivedTypeAttribute() { } + } + [System.AttributeUsage(System.AttributeTargets.Method)] + [System.Diagnostics.Conditional("MAPPERLY_ABSTRACTIONS_SCOPE_RUNTIME")] + public sealed class MapEnumAttribute : System.Attribute + { + public MapEnumAttribute(Riok.Mapperly.Abstractions.EnumMappingStrategy strategy) { } + public object? FallbackValue { get; set; } + public bool IgnoreCase { get; set; } + public Riok.Mapperly.Abstractions.EnumMappingStrategy Strategy { get; } + } + [System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=true)] + [System.Diagnostics.Conditional("MAPPERLY_ABSTRACTIONS_SCOPE_RUNTIME")] + public sealed class MapEnumValueAttribute : System.Attribute + { + public MapEnumValueAttribute(object source, object target) { } + public object Source { get; } + public object Target { get; } + } + [System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=true)] + [System.Diagnostics.Conditional("MAPPERLY_ABSTRACTIONS_SCOPE_RUNTIME")] + public sealed class MapNestedPropertiesAttribute : System.Attribute + { + public MapNestedPropertiesAttribute(string source) { } + public MapNestedPropertiesAttribute(string[] source) { } + public System.Collections.Generic.IReadOnlyCollection Source { get; } + public string SourceFullName { get; } + } + [System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=true)] + [System.Diagnostics.Conditional("MAPPERLY_ABSTRACTIONS_SCOPE_RUNTIME")] + public sealed class MapPropertyAttribute : System.Attribute + { + public MapPropertyAttribute(string source, string target) { } + public MapPropertyAttribute(string[] source, string target) { } + public MapPropertyAttribute(string source, string[] target) { } + [System.Obsolete("Use MapPropertyAttribute(string[], string) or MapPropertyAttribute(string, string" + + "[]) instead.")] + public MapPropertyAttribute(string[] source, string[] target) { } + public string? FormatProvider { get; set; } + public System.Collections.Generic.IReadOnlyCollection Source { get; } + public string SourceFullName { get; } + public string? StringFormat { get; set; } + public System.Collections.Generic.IReadOnlyCollection Target { get; } + public string TargetFullName { get; } + public string? Use { get; set; } + } + [System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=true)] + [System.Diagnostics.Conditional("MAPPERLY_ABSTRACTIONS_SCOPE_RUNTIME")] + public sealed class MapPropertyFromSourceAttribute : System.Attribute + { + public MapPropertyFromSourceAttribute(string target) { } + public MapPropertyFromSourceAttribute(string[] target) { } + public string? FormatProvider { get; set; } + public string? StringFormat { get; set; } + public System.Collections.Generic.IReadOnlyCollection Target { get; } + public string TargetFullName { get; } + public string? Use { get; set; } + } + [System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=true)] + [System.Diagnostics.Conditional("MAPPERLY_ABSTRACTIONS_SCOPE_RUNTIME")] + public sealed class MapValueAttribute : System.Attribute + { + public MapValueAttribute(string target) { } + public MapValueAttribute(string[] target) { } + public MapValueAttribute(string target, object? value) { } + public MapValueAttribute(string[] target, object? value) { } + public System.Collections.Generic.IReadOnlyCollection Target { get; } + public string TargetFullName { get; } + public string? Use { get; set; } + public object? Value { get; } + } + [System.AttributeUsage(System.AttributeTargets.Class)] + [System.Diagnostics.Conditional("MAPPERLY_ABSTRACTIONS_SCOPE_RUNTIME")] + public class MapperAttribute : System.Attribute + { + public MapperAttribute() { } + public bool AllowNullPropertyAssignment { get; set; } + public bool AutoUserMappings { get; set; } + public Riok.Mapperly.Abstractions.MappingConversionType EnabledConversions { get; set; } + public bool EnumMappingIgnoreCase { get; set; } + public Riok.Mapperly.Abstractions.EnumMappingStrategy EnumMappingStrategy { get; set; } + public Riok.Mapperly.Abstractions.IgnoreObsoleteMembersStrategy IgnoreObsoleteMembersStrategy { get; set; } + public Riok.Mapperly.Abstractions.MemberVisibility IncludedConstructors { get; set; } + public Riok.Mapperly.Abstractions.MemberVisibility IncludedMembers { get; set; } + public bool PreferParameterlessConstructors { get; set; } + public Riok.Mapperly.Abstractions.PropertyNameMappingStrategy PropertyNameMappingStrategy { get; set; } + public Riok.Mapperly.Abstractions.RequiredMappingStrategy RequiredMappingStrategy { get; set; } + public bool ThrowOnMappingNullMismatch { get; set; } + public bool ThrowOnPropertyMappingNullMismatch { get; set; } + public bool UseDeepCloning { get; set; } + public bool UseReferenceHandling { get; set; } + } + [System.AttributeUsage(System.AttributeTargets.Constructor)] + [System.Diagnostics.Conditional("MAPPERLY_ABSTRACTIONS_SCOPE_RUNTIME")] + public sealed class MapperConstructorAttribute : System.Attribute + { + public MapperConstructorAttribute() { } + } + [System.AttributeUsage(System.AttributeTargets.Assembly)] + [System.Diagnostics.Conditional("MAPPERLY_ABSTRACTIONS_SCOPE_RUNTIME")] + public sealed class MapperDefaultsAttribute : Riok.Mapperly.Abstractions.MapperAttribute + { + public MapperDefaultsAttribute() { } + } + [System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Field)] + [System.Diagnostics.Conditional("MAPPERLY_ABSTRACTIONS_SCOPE_RUNTIME")] + public sealed class MapperIgnoreAttribute : System.Attribute + { + public MapperIgnoreAttribute() { } + } + [System.AttributeUsage(System.AttributeTargets.Method)] + [System.Diagnostics.Conditional("MAPPERLY_ABSTRACTIONS_SCOPE_RUNTIME")] + public sealed class MapperIgnoreObsoleteMembersAttribute : System.Attribute + { + public MapperIgnoreObsoleteMembersAttribute(Riok.Mapperly.Abstractions.IgnoreObsoleteMembersStrategy ignoreObsoleteStrategy = -1) { } + public Riok.Mapperly.Abstractions.IgnoreObsoleteMembersStrategy IgnoreObsoleteStrategy { get; } + } + [System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=true)] + [System.Diagnostics.Conditional("MAPPERLY_ABSTRACTIONS_SCOPE_RUNTIME")] + public sealed class MapperIgnoreSourceAttribute : System.Attribute + { + public MapperIgnoreSourceAttribute(string source) { } + public string Source { get; } + } + [System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=true)] + [System.Diagnostics.Conditional("MAPPERLY_ABSTRACTIONS_SCOPE_RUNTIME")] + public sealed class MapperIgnoreSourceValueAttribute : System.Attribute + { + public MapperIgnoreSourceValueAttribute(object source) { } + public System.Enum? SourceValue { get; } + } + [System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=true)] + [System.Diagnostics.Conditional("MAPPERLY_ABSTRACTIONS_SCOPE_RUNTIME")] + public sealed class MapperIgnoreTargetAttribute : System.Attribute + { + public MapperIgnoreTargetAttribute(string target) { } + public string Target { get; } + } + [System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=true)] + [System.Diagnostics.Conditional("MAPPERLY_ABSTRACTIONS_SCOPE_RUNTIME")] + public sealed class MapperIgnoreTargetValueAttribute : System.Attribute + { + public MapperIgnoreTargetValueAttribute(object target) { } + public System.Enum? TargetValue { get; } + } + [System.AttributeUsage(System.AttributeTargets.Method)] + [System.Diagnostics.Conditional("MAPPERLY_ABSTRACTIONS_SCOPE_RUNTIME")] + public sealed class MapperRequiredMappingAttribute : System.Attribute + { + public MapperRequiredMappingAttribute(Riok.Mapperly.Abstractions.RequiredMappingStrategy requiredMappingStrategy) { } + public Riok.Mapperly.Abstractions.RequiredMappingStrategy RequiredMappingStrategy { get; } + } + [System.Flags] + public enum MappingConversionType + { + None = 0, + Constructor = 1, + ImplicitCast = 2, + ExplicitCast = 4, + ParseMethod = 8, + ToStringMethod = 16, + StringToEnum = 32, + EnumToString = 64, + EnumToEnum = 128, + DateTimeToDateOnly = 256, + DateTimeToTimeOnly = 512, + Queryable = 1024, + Enumerable = 2048, + Dictionary = 4096, + Span = 8192, + Memory = 16384, + Tuple = 32768, + EnumUnderlyingType = 65536, + All = -1, + } + [System.AttributeUsage(System.AttributeTargets.Parameter)] + [System.Diagnostics.Conditional("MAPPERLY_ABSTRACTIONS_SCOPE_RUNTIME")] + public sealed class MappingTargetAttribute : System.Attribute + { + public MappingTargetAttribute() { } + } + [System.Flags] + public enum MemberVisibility + { + AllAccessible = 31, + All = 30, + Accessible = 1, + Public = 2, + Internal = 4, + Protected = 8, + Private = 16, + } + [System.AttributeUsage(System.AttributeTargets.Method)] + [System.Diagnostics.Conditional("MAPPERLY_ABSTRACTIONS_SCOPE_RUNTIME")] + public sealed class ObjectFactoryAttribute : System.Attribute + { + public ObjectFactoryAttribute() { } + } + public enum PropertyNameMappingStrategy + { + CaseSensitive = 0, + CaseInsensitive = 1, + } + [System.Flags] + public enum RequiredMappingStrategy + { + None = 0, + Both = -1, + Source = 1, + Target = 2, + } + [System.AttributeUsage(System.AttributeTargets.Property | System.AttributeTargets.Field)] + [System.Diagnostics.Conditional("MAPPERLY_ABSTRACTIONS_SCOPE_RUNTIME")] + public sealed class UseMapperAttribute : System.Attribute + { + public UseMapperAttribute() { } + } + [System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=true)] + [System.Diagnostics.Conditional("MAPPERLY_ABSTRACTIONS_SCOPE_RUNTIME")] + public sealed class UseStaticMapperAttribute : System.Attribute + { + public UseStaticMapperAttribute(System.Type mapperType) { } + } + [System.AttributeUsage(System.AttributeTargets.Class, AllowMultiple=true)] + [System.Diagnostics.Conditional("MAPPERLY_ABSTRACTIONS_SCOPE_RUNTIME")] + public sealed class UseStaticMapperAttribute : System.Attribute + { + public UseStaticMapperAttribute() { } + } + [System.AttributeUsage(System.AttributeTargets.Method)] + [System.Diagnostics.Conditional("MAPPERLY_ABSTRACTIONS_SCOPE_RUNTIME")] + public sealed class UserMappingAttribute : System.Attribute + { + public UserMappingAttribute() { } + public bool Default { get; set; } + public bool Ignore { get; set; } + } +} +namespace Riok.Mapperly.Abstractions.ReferenceHandling +{ + public interface IReferenceHandler + { + void SetReference(TSource source, TTarget target) + where TSource : notnull + where TTarget : notnull; + bool TryGetReference(TSource source, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out TTarget? target) + where TSource : notnull + where TTarget : notnull; + } + public sealed class PreserveReferenceHandler : Riok.Mapperly.Abstractions.ReferenceHandling.IReferenceHandler + { + public PreserveReferenceHandler() { } + public void SetReference(TSource source, TTarget target) + where TSource : notnull + where TTarget : notnull { } + public bool TryGetReference(TSource source, [System.Diagnostics.CodeAnalysis.NotNullWhen(true)] out TTarget? target) + where TSource : notnull + where TTarget : notnull { } + } + [System.AttributeUsage(System.AttributeTargets.Parameter)] + [System.Diagnostics.Conditional("MAPPERLY_ABSTRACTIONS_SCOPE_RUNTIME")] + public sealed class ReferenceHandlerAttribute : System.Attribute + { + public ReferenceHandlerAttribute() { } + } +} \ No newline at end of file