Files
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;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Centron.BusinessLogic;
using Centron.BusinessLogic.Sales.Receipts;
using Centron.BusinessLogic.WebServices.Sales.Receipts;
using Centron.BusinessLogic.WebServices.Sales.Receipts.ReceiptSearch;
using Centron.Data.WebServices.Sales.Receipts.ReceiptSearch;
using Centron.Interfaces;
using Centron.Interfaces.BL;
using Centron.Interfaces.Sales.Receipts.ReceiptSearch;
using Centron.Tests.EndToEnd.Infrastructure;
using Xunit.Abstractions;
namespace Centron.Tests.EndToEnd.Tests.ReceiptPrices
{
public class ReceiptPricesTests : EndToEndTest
{
public ReceiptPricesTests(ITestOutputHelper testOutputHelper)
: base(testOutputHelper)
{
}
public override void Execute()
{
// It seems a bit excessive to test all the receipts in the database
// But it only takes 20 seconds, sooooo that's kinda easy
// And I hope that we catch every edge case like that (okay, not with swiss-rounding, but still)
var allReceipts = this.GetAllReceiptsInDatabase()
.Where(f => f.ObjectKind != (int)CentronObjectKindNumeric.SupplierOffer) //Gotta skip supplier-offers, we don't really support them anymore
.OrderBy(f => f.ObjectKind)
.ThenBy(f => f.Number);
foreach (var receipt in allReceipts)
{
this.CalculatePrices((CentronObjectKindNumeric)receipt.ObjectKind, receipt.I3D);
}
}
private IList<ReceiptSearchItemDTO> GetAllReceiptsInDatabase()
{
using var session = new BLSession();
var allReceipts = session.GetBL<ReceiptSearchWebServiceBL>().SearchReceipts(
this.GetLoggedInUser(),
new ReceiptSearchFilter
{
IncludeClosedReceipts = true,
},
page: 1,
int.MaxValue);
return allReceipts.ThrowIfError().Result;
}
private void CalculatePrices(CentronObjectKindNumeric receiptKind, int receiptI3D)
{
using var session = new BLSession();
var receipt = session.GetBL<ReceiptBL>().GetReceiptByI3D(receiptKind, receiptI3D);
var prices = session.GetBL<ReceiptPriceHelperBL>().CalculateReceiptPrices(receipt);
var pricesForVerifier = new
{
prices.NetPrice,
prices.TaxPrice,
prices.NetPriceFC,
prices.TaxPriceFC,
prices.NotDiscountableNetPriceFC,
prices.NotDiscountableTaxPriceFC,
};
this.Verifier.Verify($"PricesFor_{receiptKind.GetReceiptShortName()}_{receiptI3D}", pricesForVerifier);
}
}
}