QuellCode/CentronERP war nur als Gitlink (Submodul-Referenz auf 79c1142) getrackt, ohne .gitmodules und ohne erreichbares Remote. Der Untersuchungsgegenstand der Versuchsreihe war damit nicht reproduzierbar gesichert: Ein Klon haette ein leeres Verzeichnis erhalten, und die Belege der 3.287 Anforderungen waeren nicht ueberpruefbar gewesen. Umstellung: - Historie nach c:\DEV\CentronERP_git_snapshot_79c1142 ausgelagert (vollstaendig lesbar, enthaelt 79c1142 und Vorgaenger 89ccfd6) - Gitlink aus dem Index entfernt - Dateiinhalt aufgenommen: 24.557 Dateien, rund 333 MB Die verschachtelte .gitignore der Codebasis gilt weiter, Build-Artefakte bleiben ausgeschlossen. Details in Versuche/Versuch_01/_Codebasis-Nachweis.md
64 lines
2.2 KiB
C#
64 lines
2.2 KiB
C#
using Centron.Tests.EndToEnd.Infrastructure;
|
|
using System;
|
|
using Xunit;
|
|
using Xunit.Abstractions;
|
|
using Centron.BusinessLogic.Administration.Scripts.ScriptMethods;
|
|
using System.Text.RegularExpressions;
|
|
using System.Linq;
|
|
|
|
namespace Centron.Tests.EndToEnd.Tests.ScriptMethods
|
|
{
|
|
public class ScriptMethodTests : CentronTest
|
|
{
|
|
|
|
public ScriptMethodTests(ITestOutputHelper testOutputHelper)
|
|
: base(testOutputHelper)
|
|
{
|
|
|
|
}
|
|
|
|
[Fact]
|
|
public void CheckScriptNumbers()
|
|
{
|
|
var pool = new ScriptMethodPool();
|
|
|
|
foreach (var currentMethod in pool.ScriptMethods)
|
|
{
|
|
var numberInClassNameMatch = Regex.Match(currentMethod.GetType().Name, "\\d{5,}");
|
|
|
|
Assert.True(numberInClassNameMatch.Success, $"{currentMethod.GetType().Name} does not have a scriptnumber in its classname");
|
|
|
|
var numberInClassName = int.Parse(numberInClassNameMatch.Value);
|
|
|
|
Assert.Equal(numberInClassName, currentMethod.ScriptNumber);
|
|
}
|
|
|
|
var doubles = pool.ScriptMethods.GroupBy(f => f.ScriptNumber).Where(f => f.Count() != 1).ToList();
|
|
|
|
Assert.Empty(doubles);
|
|
}
|
|
|
|
[Fact]
|
|
public void CheckNoNewRiverScriptNumbers()
|
|
{
|
|
// We used to have a lot of scripts with numbers above 50000 from riverbird
|
|
// They got removed from our code-base when we forked the code-base
|
|
// But that means, there are lots of customer databases out there, that have already executed scripts above 50000
|
|
// If we now accidentally use one of those script numbers ourselves, then that script might not get executed for all customers
|
|
// So this test checks, that we don't accidentally add a new script with number above 50000
|
|
|
|
var pool = new ScriptMethodPool();
|
|
var riverScripts = pool.ScriptMethods
|
|
.Where(f => f.ScriptNumber >= 50000)
|
|
.Select(f => new
|
|
{
|
|
ScriptNumber = f.ScriptNumber,
|
|
Name = f.GetType().Name
|
|
})
|
|
.ToList();
|
|
|
|
this.Verifier.Verify("RiverScripts", riverScripts);
|
|
}
|
|
}
|
|
}
|