Skip to content
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
1 change: 1 addition & 0 deletions SQLite.Framework.Base/SQLite.Framework.Base.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
</ItemGroup>

<ItemGroup>
<InternalsVisibleTo Include="SQLite.Framework.DependencyInjection" />
<InternalsVisibleTo Include="SQLite.Framework.Tests" />
<InternalsVisibleTo Include="SQLite.Framework.Tests.Base" />
<InternalsVisibleTo Include="SQLite.Framework.Tests.Bundled" />
Expand Down
1 change: 1 addition & 0 deletions SQLite.Framework.Bundled/SQLite.Framework.Bundled.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
</ItemGroup>

<ItemGroup>
<InternalsVisibleTo Include="SQLite.Framework.DependencyInjection" />
<InternalsVisibleTo Include="SQLite.Framework.Tests" />
<InternalsVisibleTo Include="SQLite.Framework.Tests.Base" />
<InternalsVisibleTo Include="SQLite.Framework.Tests.Bundled" />
Expand Down
1 change: 1 addition & 0 deletions SQLite.Framework.Cipher/SQLite.Framework.Cipher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
</ItemGroup>

<ItemGroup>
<InternalsVisibleTo Include="SQLite.Framework.DependencyInjection" />
<InternalsVisibleTo Include="SQLite.Framework.Tests" />
<InternalsVisibleTo Include="SQLite.Framework.Tests.Base" />
<InternalsVisibleTo Include="SQLite.Framework.Tests.Bundled" />
Expand Down
Original file line number Diff line number Diff line change
@@ -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<InternalsVisibleToAttribute>()
.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);
}
}
Loading