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
70 lines
3.1 KiB
C#
70 lines
3.1 KiB
C#
using Centron.BusinessLogic;
|
|
using Centron.BusinessLogic.Sales.Receipts.ArticleSearch;
|
|
using Centron.BusinessLogic.Sales.Receipts.Internal;
|
|
using Centron.BusinessLogic.Warehousing;
|
|
using Centron.Tests.EndToEnd.Infrastructure;
|
|
using Xunit;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace Centron.Tests.EndToEnd.TicketTests.Ticket103420
|
|
{
|
|
public class Ticket103420Test : EndToEndTest
|
|
{
|
|
public const int CurrencyFactorArticleI3D = 4363;
|
|
public const int ControlGroupArticleI3D = 4350;
|
|
|
|
public Ticket103420Test(ITestOutputHelper testOutputHelper)
|
|
: base(testOutputHelper)
|
|
{
|
|
}
|
|
|
|
public override void Execute()
|
|
{
|
|
this.PrepareDatabase();
|
|
|
|
// Alright, in the database is article 4363 with
|
|
// - currency-factor 1.0
|
|
// - currency-factor country 2 (belgium)
|
|
// - purchase-price and sell-price of 150
|
|
|
|
// And country 2 (belgium) with currency-factor right now of 1.5
|
|
|
|
// That means, if we now calculate this articles prices, we should get
|
|
// CurrentPrice = Price * Article.CurrencyFactor / Country.CurrencyFactor
|
|
// 100 € = 150 € * 1.0 / 1.5
|
|
|
|
// The control group article 4350 has the same prices, but still currency-factor country 1
|
|
|
|
this.ValidatePrices(CurrencyFactorArticleI3D, expectedPrice: 100m);
|
|
this.ValidatePrices(ControlGroupArticleI3D, expectedPrice: 150m);
|
|
}
|
|
|
|
private void PrepareDatabase()
|
|
{
|
|
this.Sql($"UPDATE dbo.ARTIK SET FremdwaehrungLandI3D = 2, VK_1 = 150, VK_2 = 150, VK_3 = 150, VK_4 = 150, EK = 150 WHERE I3D = {CurrencyFactorArticleI3D}");
|
|
this.Sql($"UPDATE dbo.ARTIK SET VK_1 = 150, VK_2 = 150, VK_3 = 150, VK_4 = 150, EK = 150 WHERE I3D = {ControlGroupArticleI3D}");
|
|
|
|
this.Sql($"UPDATE dbo.Laenkenn SET KursZuEur = 1.5 WHERE I3D = 2");
|
|
}
|
|
|
|
private void ValidatePrices(int articleI3D, decimal expectedPrice)
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
var article = session.GetBL<ArticleBL>().GetArticleByI3D(articleI3D);
|
|
var searchedArticle = session.GetBL<ArticleSearchBL>().GetSearchedArticle(isExternalArticle: false, articleI3D, calculatePrices: false);
|
|
|
|
var articlePurchasePrice = session.GetBL<ReceiptItemPriceBL>().GetPurchaseBasePrice(article, warehouseI3D: null, specialAgreement: null);
|
|
var searchedArticlePurchasePrice = session.GetBL<ReceiptItemPriceBL>().GetPurchaseBasePrice(searchedArticle, warehouseI3D: null, specialAgreement: null);
|
|
Assert.Equal(expectedPrice, articlePurchasePrice);
|
|
Assert.Equal(expectedPrice, searchedArticlePurchasePrice);
|
|
|
|
var (articlePrice, _) = session.GetBL<ReceiptItemPriceBL>().GetBasePrice(articlePurchasePrice, article);
|
|
var (searchedArticlePrice, _) = session.GetBL<ReceiptItemPriceBL>().GetBasePrice(searchedArticlePurchasePrice, searchedArticle);
|
|
Assert.Equal(expectedPrice, articlePrice);
|
|
Assert.Equal(expectedPrice, searchedArticlePrice);
|
|
}
|
|
}
|
|
}
|
|
}
|