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
87 lines
4.1 KiB
C#
87 lines
4.1 KiB
C#
using System.Linq;
|
|
using Centron.BusinessLogic;
|
|
using Centron.BusinessLogic.EmployeeArea;
|
|
using Centron.BusinessLogic.WebServices.Sales.Receipts;
|
|
using Centron.Data.Entities.Administration.Logins;
|
|
using Centron.Interfaces;
|
|
using Centron.Interfaces.BL;
|
|
using Centron.Tests.EndToEnd.Infrastructure;
|
|
using Xunit;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace Centron.Tests.EndToEnd.Tests.ReceiptsDefaultArticleSearchQuantity
|
|
{
|
|
public class ReceiptsDefaultArticleSearchQuantityTests : EndToEndTest
|
|
{
|
|
public ReceiptsDefaultArticleSearchQuantityTests(ITestOutputHelper testOutputHelper)
|
|
: base(testOutputHelper)
|
|
{
|
|
}
|
|
|
|
// We need a offer so we can create new receipt-items for it, but we don't actually save the offer or something like that
|
|
// We just use it to call CreateArticleReceiptItems
|
|
const int OfferI3D = 1381;
|
|
|
|
// The main-article 69 has a following-article 49, and the accessory-articles 90, 91, 92, 134
|
|
private const int MainArticleI3D = 69;
|
|
|
|
private const int FollowingArticleI3D = 46;
|
|
private const int FollowingArticleDefaultQuantity = 20;
|
|
|
|
private const int AccessoryArticle1I3D = 90;
|
|
private const int AccessoryArticle1DefaultQuantity = 10;
|
|
|
|
private const int AccessoryArticle2I3D = 91;
|
|
private const int AccessoryArticle2DefaultQuantity = 13;
|
|
|
|
private const int AccessoryArticle3I3D = 92;
|
|
private const int AccessoryArticle3DefaultQuantity = 17;
|
|
|
|
private const int AccessoryArticle4I3D = 134;
|
|
private const int AccessoryArticle4DefaultQuantity = 19;
|
|
|
|
public override void Execute()
|
|
{
|
|
// This test makes sure that the Article.DefaultArticleSearchQuantity works correctly for following-articles and accessory-articles
|
|
|
|
this.PrepareDatabase();
|
|
|
|
using var session = new BLSession();
|
|
var user = session.GetBL<AppUserBL>().GetAppUser(f => f.I3D == 11);
|
|
|
|
var offer = session.GetBL<ReceiptWebServiceBL>().GetReceiptByI3D(OfferI3D, CentronObjectKindNumeric.OfferClass).ThrowIfError();
|
|
|
|
var receiptItems = session.GetBL<ReceiptItemWebServiceBL>().CreateArticleReceiptItems(
|
|
offer,
|
|
isExternalArticle: false,
|
|
MainArticleI3D,
|
|
externalArticleKind: null,
|
|
externalArticleId: null,
|
|
warehouseI3D: -1,
|
|
new LoggedInUser(user));
|
|
|
|
AssertArticleQuantity(FollowingArticleI3D, FollowingArticleDefaultQuantity);
|
|
AssertArticleQuantity(AccessoryArticle1I3D, AccessoryArticle1DefaultQuantity);
|
|
AssertArticleQuantity(AccessoryArticle2I3D, AccessoryArticle2DefaultQuantity);
|
|
AssertArticleQuantity(AccessoryArticle3I3D, AccessoryArticle3DefaultQuantity);
|
|
AssertArticleQuantity(AccessoryArticle4I3D, AccessoryArticle4DefaultQuantity);
|
|
|
|
this.Verifier.Verify("ReceiptItems", receiptItems);
|
|
|
|
void AssertArticleQuantity(int articleI3D, int expectedQuantity)
|
|
{
|
|
var item = receiptItems.Data.ReceiptItems.Single(f => f.ArticleI3D == articleI3D);
|
|
Assert.Equal(expectedQuantity, item.QuantityComplete);
|
|
}
|
|
}
|
|
|
|
private void PrepareDatabase()
|
|
{
|
|
this.Sql($"UPDATE dbo.ARTIK SET DefaultArticleSearchQuantity = {FollowingArticleDefaultQuantity} WHERE I3D = {FollowingArticleI3D}");
|
|
this.Sql($"UPDATE dbo.ARTIK SET DefaultArticleSearchQuantity = {AccessoryArticle1DefaultQuantity} WHERE I3D = {AccessoryArticle1I3D}");
|
|
this.Sql($"UPDATE dbo.ARTIK SET DefaultArticleSearchQuantity = {AccessoryArticle2DefaultQuantity} WHERE I3D = {AccessoryArticle2I3D}");
|
|
this.Sql($"UPDATE dbo.ARTIK SET DefaultArticleSearchQuantity = {AccessoryArticle3DefaultQuantity} WHERE I3D = {AccessoryArticle3I3D}");
|
|
this.Sql($"UPDATE dbo.ARTIK SET DefaultArticleSearchQuantity = {AccessoryArticle4DefaultQuantity} WHERE I3D = {AccessoryArticle4I3D}");
|
|
}
|
|
}
|
|
} |