Files
Masterarbeit/QuellCode/CentronERP/tests/Centron.Tests.EndToEnd/TicketTests/Ticket139552/Ticket139552Tests.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

90 lines
3.8 KiB
C#

using System.Collections.Generic;
using Centron.BusinessLogic.Administration.Settings;
using Centron.BusinessLogic.Sales.Receipts.DataAndResults;
using Centron.BusinessLogic.WebServices.Sales.Receipts;
using Centron.Core.Extensions;
using Centron.Interfaces;
using Centron.Interfaces.BL;
using Centron.Interfaces.Sales.Receipts.InsertReceipts;
using Centron.Tests.EndToEnd.Infrastructure;
using CentronSoftware.Centron.WebServices.EntitiesWrongPlace.Sales.Receipts.DataAndResults;
using Xunit;
using Xunit.Abstractions;
namespace Centron.Tests.EndToEnd.TicketTests.Ticket139552;
public class Ticket139552Tests : EndToEndTest
{
public Ticket139552Tests(ITestOutputHelper testOutputHelper)
: base(testOutputHelper)
{
}
public const int OfferI3D = 4453;
public const int ArticleI3D = 1210;
public override void Execute()
{
// In this ticket the problem was, that we didn't show a warning message to the user when
// he forwarded EOL articles from offer to order
this.PrepareDatabase();
this.ExecuteMatrix(
new [] {false, true},
new [] {CentronObjectKindNumeric.OrderClass, CentronObjectKindNumeric.DeliveryListClass},
new [] {InsertReceiptTakeoverOptions.Reference, InsertReceiptTakeoverOptions.Copy},
(eolSetting, receiptKind, takeoverOptions) =>
{
// Update setting
this.Sql($"UPDATE dbo.Stammdat SET Wert = {eolSetting.ToOneZeroInteger()} WHERE I3D = {(int)AppSettingsConst.CheckArticleEolAtAttachmentProcessing}");
// Forward receipt
var result = this.WithSession(s => s.GetBL<ReceiptWebServiceBL>().ForwardReceipt(
receiptKind,
this.GetLoggedInUser().User,
new ForwardReceiptData
{
IgnoreCallbacks = true,
CreateReceiptData = new CreateReceiptData
{
IgnoreCallbacks = true,
},
CreateReceiptItemsFromExistingItemsData = new List<CreateReceiptItemsFromExistingItemsData>
{
new CreateReceiptItemsFromExistingItemsData
{
// Has to be false, because the warning message is only shown if it's false
IgnoreCallbacks = false,
}
},
},
new List<ReceiptToForward>
{
new ReceiptToForward
{
ReceiptKind = CentronObjectKindNumeric.OfferClass,
ReceiptI3D = OfferI3D,
}
},
null,
takeoverOptions,
onlyTakeoverAvailableQuantity: false,
ignoreDefaultContract: true));
result.ThrowIfError();
// Assert
var shouldHaveWarningMessage = eolSetting && receiptKind is CentronObjectKindNumeric.OrderClass; // InsertReceiptTakeoverOptions does not matter, the message should come in both cases (Reference and Copy)
var expectedMessage = shouldHaveWarningMessage
? "Folgende Artikel sind EOL: 104"
: "";
Assert.Equal(expectedMessage, result.Data.CreateReceiptItemsFromExistingItemsResults[0].Message);
});
}
private void PrepareDatabase()
{
this.Sql($"UPDATE dbo.AngKopf SET Status = 1 WHERE I3D = {OfferI3D}");
this.Sql($"UPDATE dbo.ARTIK SET EOL = 1 WHERE I3D = {ArticleI3D}");
}
}