using System; using System.Linq; using Centron.BusinessLogic.Administration.Company; using Centron.DAO; using Centron.Data.Entities.Administration.Company; using Centron.Tests.EndToEnd.Infrastructure; using Xunit.Abstractions; namespace Centron.Tests.EndToEnd.Tests.Administration.NumberGroups; public class NumberGroupRefreshTest : EndToEndTest { public NumberGroupRefreshTest(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { } public override void Execute() { using var session = new DAOSession(); var toIgnore = session.GetSession().Query().Where(f => f.Description == "[nicht verwendet]").ToList(); new NumberGroupBL(session).RefreshAllNumberGroups(); Verifier.VerifySql("NumberGroupRefreshTest_AfterRefresh", "SELECT * FROM Nummernkreis ORDER BY I3D"); var allNumberGroups = session.GetSession().Query().ToList(); if (allNumberGroups.Any(f => f.Description == "[nicht verwendet]" && toIgnore.All(ff => ff.I3D != f.I3D))) throw new Exception("Method 'RefreshAllNumberGroups' created new [nicht verwenden] entries! Please update the ignore list in the method NumberGroupBL.GetNumberGroupEnumsToCreate()."); } }