From 88fb668cc564fe18a1b7853b6712564cb94d19e3 Mon Sep 17 00:00:00 2001 From: JPVenson Date: Mon, 21 Oct 2024 05:27:27 +0200 Subject: [PATCH] Added Unittest to check for unapplied model changes (#12854) --- .../EfMigrations/EfMigrationTests.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 tests/Jellyfin.Server.Implementations.Tests/EfMigrations/EfMigrationTests.cs diff --git a/tests/Jellyfin.Server.Implementations.Tests/EfMigrations/EfMigrationTests.cs b/tests/Jellyfin.Server.Implementations.Tests/EfMigrations/EfMigrationTests.cs new file mode 100644 index 0000000000..e6ccae1830 --- /dev/null +++ b/tests/Jellyfin.Server.Implementations.Tests/EfMigrations/EfMigrationTests.cs @@ -0,0 +1,18 @@ +using System; +using System.Threading.Tasks; +using Jellyfin.Server.Implementations.Migrations; +using Microsoft.EntityFrameworkCore; +using Xunit; + +namespace Jellyfin.Server.Implementations.Tests.EfMigrations; + +public class EfMigrationTests +{ + [Fact] + public void CheckForUnappliedMigrations() + { + var dbDesignContext = new DesignTimeJellyfinDbFactory(); + var context = dbDesignContext.CreateDbContext([]); + Assert.False(context.Database.HasPendingModelChanges(), "There are unapplied changes to the EfCore model. Please create a Migration."); + } +}