bf32a7def2
CI - Build & Test / Backend (.NET) (push) Successful in 50s
CI - Build & Test / Backend integration (PostgreSQL/Toxiproxy) (push) Failing after 58s
CI - Build & Test / Frontend (Vue/TS) (push) Has been cancelled
CI - Build & Test / Security Check (push) Has been cancelled
CI - Build & Test / Deploy Nexus (push) Has been cancelled
38 lines
1.3 KiB
C#
38 lines
1.3 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
using Nexus.Api.Data;
|
|
using Nexus.Api.Migrations;
|
|
using Xunit;
|
|
|
|
namespace Nexus.Api.Tests;
|
|
|
|
public sealed class MigrationSnapshotTests
|
|
{
|
|
[Fact]
|
|
public void Historical_task_migrations_are_discoverable()
|
|
{
|
|
var options = new DbContextOptionsBuilder<NexusDbContext>()
|
|
.UseNpgsql(
|
|
"Host=127.0.0.1;Database=nexus_migration_contract;Username=nexus;Password=unused")
|
|
.Options;
|
|
using var db = new NexusDbContext(options);
|
|
var migrations = db.GetService<IMigrationsAssembly>().Migrations.Keys;
|
|
|
|
Assert.Contains("20260618233000_AddTaskParentChild", migrations);
|
|
Assert.Contains("20260618233001_AddTaskDueDate", migrations);
|
|
Assert.Contains("20260618233002_AddActivityTaskReference", migrations);
|
|
}
|
|
|
|
[Fact]
|
|
public void Snapshot_builds_agent_provisioning_relationships()
|
|
{
|
|
var model = new NexusDbContextModelSnapshot().Model;
|
|
var proposal = model.FindEntityType("Nexus.Api.Data.AgentProposal");
|
|
var request = model.FindEntityType("Nexus.Api.Data.AgentProvisionRequest");
|
|
|
|
Assert.NotNull(proposal?.FindNavigation("ProvisionRequests"));
|
|
Assert.NotNull(request?.FindNavigation("Proposal"));
|
|
}
|
|
}
|