Files
Masterarbeit/QuellCode/CentronERP/tests/Centron.Tests.EndToEnd/TicketTests/Ticket121005/Ticket121005Tests.cs
T
Christoph Schwörer f045b99a25 Codebasis als Dateien ins Arbeitsrepo statt als Gitlink
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
2026-08-26 07:43:51 +02:00

60 lines
2.9 KiB
C#

using Centron.BusinessLogic;
using Centron.BusinessLogic.Sales.Receipts;
using Centron.BusinessLogic.Sales.Receipts.Orders;
using Centron.Data.Entities.Sales.Receipts.Orders;
using Centron.Tests.EndToEnd.Infrastructure;
using Xunit.Abstractions;
namespace Centron.Tests.EndToEnd.TicketTests.Ticket121005
{
public class Ticket121005Tests : EndToEndTest
{
public Ticket121005Tests(ITestOutputHelper testOutputHelper)
: base(testOutputHelper)
{
}
public override void Execute()
{
// The issue here is with the ReceiptOrderBL.SendOrderNotificationMails
// Specifically the "article notification email" (ReceiptOrderBL.SendArticleNotificationEmail)
//
// When you create a new order (version 1) with many positions and other changes, and save it
// and then, without closing the module, you created a new version (version 2) of it, with only minor changes
// The "article notification mail" would only send a mail for the minor changes of version 2 (it used to compare current version with the one before that)
//
// But that is kind of incorrect, because the user just created that receipt, we wanna send the "article notification mail" for all changes in version 1 and 2
// One could say, that the order was in "version 0" before we started making changes
//
// Internally, the ReceiptOrderBL.SendArticleNotificationEmail uses the ReceiptOrderBL.GetAddedReceiptOrderPositionI3Ds to get a list of all added or changed position-I3Ds
// Fix this method, to work correctly when you changed multiple versions
this.VerifyAddedPositionsForOrderInAllVersions(orderI3D: 214, currentVersion: 5);
this.VerifyAddedPositionsForOrderInAllVersions(orderI3D: 113, currentVersion: 5);
this.VerifyAddedPositionsForOrderInAllVersions(orderI3D: 137, currentVersion: 3);
}
private void VerifyAddedPositionsForOrderInAllVersions(int orderI3D, int currentVersion)
{
// Run it once for the "previous version"
this.VerifyAddedPositionsForOrder(orderI3D);
// And then for all versions before that
while (currentVersion > 0)
{
this.VerifyAddedPositionsForOrder(orderI3D, --currentVersion);
}
}
private void VerifyAddedPositionsForOrder(int orderI3D, int previousVersion = -1)
{
using var session = new BLSession();
var order = session.GetBL<ReceiptBL>().GetReceiptByI3D<ReceiptOrder>(orderI3D);
var addedPositions = session.GetBL<ReceiptOrderBL>().GetAddedReceiptOrderPositionI3Ds(order, previousVersion);
this.Verifier.Verify($"AddedPositions_Order_{orderI3D}_Version_{previousVersion}", addedPositions);
}
}
}