Files
Masterarbeit/QuellCode/CentronERP/tests/Centron.Tests.EndToEnd/Tests/ReceiptResultBuilder/ReceiptResultBuilderTests.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

78 lines
2.8 KiB
C#

using System.Collections.Generic;
using Centron.BusinessLogic;
using Centron.BusinessLogic.Administration.Settings;
using Centron.BusinessLogic.Sales.Receipts.DataAndResults;
using Centron.BusinessLogic.WebServices.Sales.Receipts;
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.Tests.ReceiptResultBuilder;
public class ReceiptResultBuilderTests : EndToEndTest
{
public ReceiptResultBuilderTests(ITestOutputHelper testOutputHelper)
: base(testOutputHelper)
{
}
public override void Execute()
{
this.PrepareDatabase();
this.TryForwardInvoiceToCreditVoucher();
}
private void PrepareDatabase()
{
this.Sql($"UPDATE dbo.Stammdat SET Wert = 1 WHERE I3D = {(int)AppSettingsConst.IsTaxNumberForCreditCreationMandatory}");
}
private void TryForwardInvoiceToCreditVoucher()
{
const int InvoiceI3D = 1365;
using var session = new BLSession();
var forwardResult = session.GetBL<ReceiptWebServiceBL>().ForwardReceipt(
CentronObjectKindNumeric.CreditVoucherClass,
this.GetLoggedInUser().User,
new ForwardReceiptData
{
IgnoreCallbacks = true,
CreateReceiptData = new CreateReceiptData
{
IgnoreCallbacks = true,
},
CreateReceiptItemsFromExistingItemsData = new List<CreateReceiptItemsFromExistingItemsData>
{
new()
{
IgnoreCallbacks = true,
},
},
},
new List<ReceiptToForward>
{
new()
{
ReceiptKind = CentronObjectKindNumeric.InvoiceClass,
ReceiptI3D = InvoiceI3D
}
},
null,
InsertReceiptTakeoverOptions.Reference,
onlyTakeoverAvailableQuantity: false,
ignoreDefaultContract: false);
// Forwarding the invoice should have failed in CreateNewReceipt<T>
// Now we expect the error message from the CreateReceiptResult.Message to also be visible in the ForwardReceiptResult.Message
Assert.Equal(ResultStatus.Error, forwardResult.Status);
Assert.Equal("Es kann leider kein Beleg (Gutschrift) erstellt werden, weil für den Kunden keine Steuernummer und keine Umsatzsteuertidentnummer hinterlegt ist!", forwardResult.Message);
Assert.Contains(forwardResult.Data.CreateReceiptResult.Message, forwardResult.Message);
}
}