Fix Api.Specs test failures: stale Timer column refs and missing test.user fixture

This commit is contained in:
Aaron Po
2026-08-20 18:46:44 -04:00
parent 0db29f431c
commit 1855041910
6 changed files with 65 additions and 14 deletions

View File

@@ -45,7 +45,7 @@ public class AuthRepositoryTests
("CreatedAt", typeof(DateTime)),
("UpdatedAt", typeof(DateTime?)),
("DateOfBirth", typeof(DateTime)),
("Timer", typeof(byte[]))
("RowVersion", typeof(byte[]))
)
.AddRow(
expectedUserId,
@@ -99,7 +99,7 @@ public class AuthRepositoryTests
("CreatedAt", typeof(DateTime)),
("UpdatedAt", typeof(DateTime?)),
("DateOfBirth", typeof(DateTime)),
("Timer", typeof(byte[]))
("RowVersion", typeof(byte[]))
)
.AddRow(
userId,
@@ -157,7 +157,7 @@ public class AuthRepositoryTests
("CreatedAt", typeof(DateTime)),
("UpdatedAt", typeof(DateTime?)),
("DateOfBirth", typeof(DateTime)),
("Timer", typeof(byte[]))
("RowVersion", typeof(byte[]))
)
.AddRow(
userId,
@@ -210,7 +210,7 @@ public class AuthRepositoryTests
("UserAccountId", typeof(Guid)),
("Hash", typeof(string)),
("CreatedAt", typeof(DateTime)),
("Timer", typeof(byte[]))
("RowVersion", typeof(byte[]))
)
.AddRow(credentialId, userId, "hashed_password_value", DateTime.UtcNow, null)
);

View File

@@ -17,7 +17,7 @@ public class AuthRepository(ISqlConnectionFactory connectionFactory)
IAuthRepository
{
private const string SelectColumns =
"UserAccountID, Username, FirstName, LastName, Email, CreatedAt, UpdatedAt, DateOfBirth, Timer";
"UserAccountID, Username, FirstName, LastName, Email, CreatedAt, UpdatedAt, DateOfBirth, RowVersion";
/// <inheritdoc />
/// <remarks>The account and credential are inserted within a single database transaction.</remarks>
@@ -92,7 +92,7 @@ public class AuthRepository(ISqlConnectionFactory connectionFactory)
await using DbConnection connection = await CreateConnection();
return await connection.QueryFirstOrDefaultAsync<UserCredential>(
"""
SELECT UserCredentialId, UserAccountId, Hash, CreatedAt, Timer
SELECT UserCredentialId, UserAccountId, Hash, CreatedAt, RowVersion
FROM dbo.UserCredential
WHERE UserAccountId = @UserAccountId AND IsRevoked = 0
""",

View File

@@ -29,7 +29,7 @@ public class UserAccountRepositoryTests
("CreatedAt", typeof(DateTime)),
("UpdatedAt", typeof(DateTime?)),
("DateOfBirth", typeof(DateTime)),
("Timer", typeof(byte[]))
("RowVersion", typeof(byte[]))
)
.AddRow(
Guid.Parse("aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"),
@@ -70,7 +70,7 @@ public class UserAccountRepositoryTests
("CreatedAt", typeof(DateTime)),
("UpdatedAt", typeof(DateTime?)),
("DateOfBirth", typeof(DateTime)),
("Timer", typeof(byte[]))
("RowVersion", typeof(byte[]))
)
.AddRow(
Guid.NewGuid(),
@@ -118,7 +118,7 @@ public class UserAccountRepositoryTests
("CreatedAt", typeof(DateTime)),
("UpdatedAt", typeof(DateTime?)),
("DateOfBirth", typeof(DateTime)),
("Timer", typeof(byte[]))
("RowVersion", typeof(byte[]))
)
.AddRow(
Guid.NewGuid(),
@@ -155,7 +155,7 @@ public class UserAccountRepositoryTests
("CreatedAt", typeof(DateTime)),
("UpdatedAt", typeof(DateTime?)),
("DateOfBirth", typeof(DateTime)),
("Timer", typeof(byte[]))
("RowVersion", typeof(byte[]))
)
.AddRow(
Guid.NewGuid(),

View File

@@ -14,7 +14,7 @@ public class UserAccountRepository(ISqlConnectionFactory connectionFactory)
IUserAccountRepository
{
private const string SelectColumns =
"UserAccountID, Username, FirstName, LastName, Email, CreatedAt, UpdatedAt, DateOfBirth, Timer";
"UserAccountID, Username, FirstName, LastName, Email, CreatedAt, UpdatedAt, DateOfBirth, RowVersion";
/// <inheritdoc />
public async Task<UserAccount?> GetByIdAsync(Guid id)