diff --git a/SQLite.Framework.Base/SQLite.Framework.Base.csproj b/SQLite.Framework.Base/SQLite.Framework.Base.csproj index 520e77b6..5e3a87c8 100644 --- a/SQLite.Framework.Base/SQLite.Framework.Base.csproj +++ b/SQLite.Framework.Base/SQLite.Framework.Base.csproj @@ -48,6 +48,7 @@ + diff --git a/SQLite.Framework.Bundled/SQLite.Framework.Bundled.csproj b/SQLite.Framework.Bundled/SQLite.Framework.Bundled.csproj index 475247ce..1458aced 100644 --- a/SQLite.Framework.Bundled/SQLite.Framework.Bundled.csproj +++ b/SQLite.Framework.Bundled/SQLite.Framework.Bundled.csproj @@ -45,6 +45,7 @@ + diff --git a/SQLite.Framework.Cipher/SQLite.Framework.Cipher.csproj b/SQLite.Framework.Cipher/SQLite.Framework.Cipher.csproj index 180fdf0e..0359e8be 100644 --- a/SQLite.Framework.Cipher/SQLite.Framework.Cipher.csproj +++ b/SQLite.Framework.Cipher/SQLite.Framework.Cipher.csproj @@ -50,6 +50,7 @@ + diff --git a/Tests/SQLite.Framework.Tests/DependencyInjection/InternalsVisibilityTests.cs b/Tests/SQLite.Framework.Tests/DependencyInjection/InternalsVisibilityTests.cs new file mode 100644 index 00000000..03fdd714 --- /dev/null +++ b/Tests/SQLite.Framework.Tests/DependencyInjection/InternalsVisibilityTests.cs @@ -0,0 +1,54 @@ +using System.Reflection; +using System.Runtime.CompilerServices; + +namespace SQLite.Framework.Tests; + +public class InternalsVisibilityTests +{ + [Fact] + public void FrameworkAssemblyKeepsTheSharedAssemblyName() + { + Assert.Equal("SQLite.Framework", typeof(SQLiteDatabase).Assembly.GetName().Name); + } + + [Fact] + public void FrameworkAssemblyGrantsInternalsToDependencyInjection() + { + string[] friends = typeof(SQLiteDatabase).Assembly + .GetCustomAttributes() + .Select(a => a.AssemblyName) + .ToArray(); + + Assert.Contains(friends, name => name == "SQLite.Framework.DependencyInjection"); + } + + [Fact] + public void MigrationActivatorDelegateIsInternal() + { + Type? type = typeof(SQLiteDatabase).Assembly.GetType("SQLite.Framework.Internals.SQLiteMigrationActivator"); + + Assert.NotNull(type); + Assert.True(type is { IsPublic: false, IsNotPublic: true }); + } + + [Fact] + public void MigrationActivatorIsAnInternalProperty() + { + PropertyInfo? property = typeof(SQLiteDatabase).GetProperty("MigrationActivator", BindingFlags.Instance | BindingFlags.NonPublic); + + Assert.NotNull(property); + Assert.NotNull(property.GetMethod); + Assert.NotNull(property.SetMethod); + Assert.True(property.GetMethod.IsAssembly); + Assert.True(property.SetMethod.IsAssembly); + } + + [Fact] + public void UseMigrationActivatorIsAnInternalMethod() + { + MethodInfo? method = typeof(SQLiteMigrationRunner).GetMethod("UseMigrationActivator", BindingFlags.Instance | BindingFlags.NonPublic); + + Assert.NotNull(method); + Assert.True(method.IsAssembly); + } +}