mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 12:11:10 +00:00
Implements tests for commit eaca69bf2a
This commit is contained in:
1 parent
94a67aded4
commit
d185c77999
15 files changed
+527
-128
No files matched your search
-38
@@ -1,38 +0,0 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Lumina.DataAccess.Common.Interceptors;
|
||||
using Lumina.DataAccess.Core.UoW;
|
||||
using Microsoft.Data.Sqlite;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Threading.Tasks;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.DataAccess.IntegrationTests.Common.Interceptors;
|
||||
|
||||
/// <summary>
|
||||
/// Contains integration tests for the <see cref="SqliteSharedReferenceNormalizationInterceptor"/> class.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class SqliteSharedReferenceNormalizationInterceptorTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(" Horror ", "horror")] // ASCII letters
|
||||
[InlineData(" ÉLECTRO ", "électro")] // non-ASCII Latin letters
|
||||
[InlineData("ЖАНР", "жанр")] // non-Latin letters
|
||||
public async Task ConnectionOpenedAsync_WhenTheConnectionIsOpened_ShouldRegisterTheInvariantNormalizationFunction(string name, string expectedName)
|
||||
{
|
||||
// Arrange
|
||||
using LuminaDbContext context = new(new DbContextOptionsBuilder<LuminaDbContext>().UseSqlite("Data Source=:memory:").Options);
|
||||
|
||||
// Act
|
||||
await context.Database.OpenConnectionAsync();
|
||||
SqliteConnection connection = (SqliteConnection)context.Database.GetDbConnection();
|
||||
await using SqliteCommand command = connection.CreateCommand();
|
||||
command.CommandText = $"SELECT {SqliteSharedReferenceNormalizationInterceptor.NORMALIZE_FUNCTION_NAME}($name);";
|
||||
command.Parameters.AddWithValue("$name", name);
|
||||
object? result = await command.ExecuteScalarAsync();
|
||||
|
||||
// Assert
|
||||
Assert.Equal(expectedName, result);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user