fix(database): qualify RD21 saves against pinned MariaDB 12.2.2

This commit is contained in:
cesnimda
2026-10-24 01:47:50 +02:00
parent 0d16a691e0
commit a2c9bda0d1
30 changed files with 2226 additions and 63 deletions
@@ -0,0 +1,23 @@
using JobTrackerApi.Models;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;
using Moq;
namespace JobTrackerApi.MariaDb.Tests;
internal static class TestHostFactory
{
public static Mock<UserManager<ApplicationUser>> CreateUserManager(ApplicationUser? lookupUser = null)
{
var manager = new Mock<UserManager<ApplicationUser>>(
Mock.Of<IUserStore<ApplicationUser>>(), Options.Create(new IdentityOptions()),
new PasswordHasher<ApplicationUser>(), Array.Empty<IUserValidator<ApplicationUser>>(),
Array.Empty<IPasswordValidator<ApplicationUser>>(), new UpperInvariantLookupNormalizer(),
new IdentityErrorDescriber(), null!, NullLogger<UserManager<ApplicationUser>>.Instance);
if (lookupUser is not null)
manager.Setup(x => x.FindByIdAsync(It.IsAny<string>()))
.ReturnsAsync((string id) => lookupUser.Id == id ? lookupUser : null);
return manager;
}
}