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

55 lines
2.1 KiB
C#

using Centron.BusinessLogic;
using Centron.BusinessLogic.Sales.Customers;
using Centron.BusinessLogic.Sales.Receipts.Internal;
using Centron.BusinessLogic.Warehousing;
using Centron.Interfaces.Accounts.SpecialPrices;
using Centron.Tests.EndToEnd.Infrastructure;
using Xunit.Abstractions;
namespace Centron.Tests.EndToEnd.Tests.SpecialPrices;
public class SpecialPriceTests : EndToEndTest
{
public SpecialPriceTests(ITestOutputHelper testOutputHelper)
: base(testOutputHelper)
{
}
public const int CustomerI3D = 10012;
public const int ArticleI3D = 17;
public override void Execute()
{
this.PrepareDatabase();
this.RunTest(SpecialPriceKind.SurchargePurchasePrice, 10);
this.RunTest(SpecialPriceKind.ReduceRecommendedSellPrice, 10);
this.RunTest(SpecialPriceKind.FixedPrice, 7.50m);
this.RunTest(SpecialPriceKind.ReduceSellPrice, 10);
this.RunTest(SpecialPriceKind.ReduceListPrice, 10);
}
private void RunTest(SpecialPriceKind kind, decimal value)
{
this.Sql($"UPDATE dbo.KundenSonderpreise SET Basis = {(int)kind}, Aufschlag = {value.ToString().Replace(",", ".")} WHERE ArtikelI3D = {ArticleI3D} AND KundenI3D = {CustomerI3D}");
using var session = new BLSession();
var article = session.GetBL<ArticleBL>().GetArticleByI3D(ArticleI3D, loadAdditionalInformations: false);
var customer = session.GetBL<CustomerBL>().GetCustomer(CustomerI3D);
var purchasePrice = session.GetBL<ReceiptItemPriceBL>().GetPurchaseBasePrice(article, warehouseI3D: -1, specialAgreementI3D: null);
var (sellPrice, discount) = session.GetBL<ReceiptItemPriceBL>().GetBasePrice(purchasePrice, article, customer, contractI3D:null, specialAgreement:null);
this.Verifier.Verify($"{kind}_{value}", new
{
PurchasePrice = purchasePrice,
SellPrice = sellPrice,
Discount = discount
});
}
private void PrepareDatabase()
{
this.Sql($"UPDATE dbo.ARTIK SET VK_1 = 100, VK_2 = 200, VK_3 = 300, VK_4 = 400, EK = 50, EVK = 500, Listenpreis = 600 WHERE I3D = {ArticleI3D}");
}
}