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

157 lines
8.4 KiB
C#

using System;
using Centron.BusinessLogic.Warehousing;
using Centron.BusinessLogic.Warehousing.StockManagement;
using Centron.BusinessLogic.WebServices.Warehousing;
using Centron.BusinessLogic.WebServices.Warehousing.StockManagement;
using Centron.Data.WebServices.Administration.MandatoryArea;
using Centron.Data.WebServices.Logistics.Warehousing;
using Centron.Data.WebServices.Warehousing.StockManagement;
using Centron.Tests.EndToEnd.Infrastructure;
using CentronSoftware.Centron.WebServices.Entities.Logistics.Warehousing;
using Xunit.Abstractions;
namespace Centron.Tests.EndToEnd.Tests.SecondaryStockArticle
{
public class SecondaryStockTest : EndToEndTest
{
public SecondaryStockTest(ITestOutputHelper testOutputHelper) : base(testOutputHelper)
{
}
public override void Execute()
{
this.PrepareDB();
this.GetAndEditSecondaryStockArticle();
this.BookInBookOut();
}
private void PrepareDB()
{
//Delete corrupted entries
this.Sql("DELETE FROM dbo.NebenlagerArtikel WHERE ArtikelI3D IS NULL OR ArtikelI3D <= 0");
//insert storage place and location
this.Sql("INSERT INTO Lagerort (Kurzbezeichnung, Bezeichnung, NebenlagerI3D, Status) VALUES ('4.0', 'FourDotzero', 6,1)");
this.Sql("INSERT INTO Lagerplatz(LagerortI3D, Kurzbezeichnung, Bezeichnung, Status) VALUES (9,'666', 'NumberOfTheBeast', 1)");
}
private void GetAndEditSecondaryStockArticle()
{
var activeFilter = new SecondaryStockArticleFilter()
{
State = true
};
var articleFilter = new SecondaryStockArticleFilter()
{
ArticleI3Ds = new[] { 4354, 4355, 4356 }
};
var stockFilter = new SecondaryStockArticleFilter()
{
SecondaryStockI3D = 7
};
var activeSecondaryStockArticles = this.WithSession(f => f.GetBL<SecondStockArticleWebServiceBL>().GetSecondaryStockArticle(activeFilter));
this.Verifier.Verify("1_activeSecondaryStockArticles", activeSecondaryStockArticles);
var articlesSecondaryStockArticles = this.WithSession(f => f.GetBL<SecondStockArticleWebServiceBL>().GetSecondaryStockArticle(articleFilter));
this.Verifier.Verify("2_articlesSecondaryStockArticles", articlesSecondaryStockArticles);
var stockSecondaryStockArticles = this.WithSession(f => f.GetBL<SecondStockArticleWebServiceBL>().GetSecondaryStockArticle(stockFilter));
this.Verifier.Verify("3_stockSecondaryStockArticles", stockSecondaryStockArticles);
for (int i = 0; i < articlesSecondaryStockArticles.Count; i++)
{
articlesSecondaryStockArticles[i].Stock = 5 + i;
articlesSecondaryStockArticles[i].StockInOrder = 5 * i;
articlesSecondaryStockArticles[i].OwnPurchasePrice = (5 + i % 2 == 0);
articlesSecondaryStockArticles[i].PurchasePrice = 5 + i * 5 + i;
articlesSecondaryStockArticles[i].RawEk1 = (5 * i) - (5 + i);
this.WithSession(f => f.GetBL<SecondStockArticleWebServiceBL>().SaveSecondaryStock(articlesSecondaryStockArticles[i]));
}
var articlesSecondaryStockArticlesAfterChange = this.WithSession(f => f.GetBL<SecondStockArticleWebServiceBL>().GetSecondaryStockArticle(articleFilter));
this.Verifier.Verify("4_articlesSecondaryStockArticlesAfterChange", articlesSecondaryStockArticlesAfterChange);
var newSecondaryStock = new SecondaryStockArticleDTO()
{
Article = new ArticleLightDTO() { I3D = 4339 },
Mandator = new MandatoryDTO() { I3D = 2 },
SecondaryStock = new StockDTO() { I3D = 6 },
StorageLocation = new StorageLocationDTO() { I3D = 9 },
StorageArea = new StorageAreaDTO() { I3D = 19 },
Intake = 1,
Stock = 2.3,
MinimumStock = 4.5,
PurchasePrice = null,
RawEk1 = 6.78m,
RawEk2 = 9.11m,
RealStock = 12.13,
ArticleInProcure = 14.15,
OwnPurchasePrice = true,
RawEk1Date = new DateTime(2000, 1, 1),
RawEk2Date = null,
StockInDelivery = 16.17,
StockInOrder = 18.19,
StockInRepair = 20.21
};
this.WithSession(f => f.GetBL<SecondStockArticleWebServiceBL>().SaveSecondaryStock(newSecondaryStock));
var newFilter = new SecondaryStockArticleFilter() { SecondaryStockI3D = 6 };
var newSecondaryStockArtcle = this.WithSession(f => f.GetBL<SecondStockArticleWebServiceBL>().GetSecondaryStockArticle(newFilter));
this.Verifier.Verify("5_newSecondaryStockArticles", newSecondaryStockArtcle);
}
private void BookInBookOut()
{
int articleWithScanBarcodeActive = 4354;
int articleWithoutScanBarcode = 58;
//this is an article with scanbarcode active -> the amount is determined of the amount of the barcodes, so the quantity should not change here
var articleWithScanBarcodeFilter = new ArticleStockInfoFilter()
{
ArticleI3D = articleWithScanBarcodeActive,
StockI3D = 7
};
this.WithSession(f => f.GetBL<SecondStockArticleWebServiceBL>().StockBookOrBookout(true, articleI3D: articleWithScanBarcodeActive, stockI3D: 7, amount: 10, "Was macht die Security in der Nudelfabrik? - Die Pasta auf.", appUserI3D: 11));
var bookInSerial = this.WithSession(f => f.GetBL<ArticleStockWebServiceBL>().SearchArticleStockInfos(articleWithScanBarcodeFilter));
this.Verifier.Verify("6_bookInSerial", bookInSerial);
this.WithSession(f => f.GetBL<SecondStockArticleWebServiceBL>().StockBookOrBookout(false, articleI3D: articleWithScanBarcodeActive, stockI3D: 2, amount: 5, "Was trinkt die Chefin ? - Leitungswasser", appUserI3D: 11));
var bookOutSerial = this.WithSession(f => f.GetBL<ArticleStockWebServiceBL>().SearchArticleStockInfos(articleWithScanBarcodeFilter));
this.Verifier.Verify("7_bookOutSerial", bookOutSerial);
var articleWithoutScanBarcodeFilter = new ArticleStockInfoFilter()
{
ArticleI3D = articleWithoutScanBarcode,
StockI3D = 7
};
this.WithSession(f => f.GetBL<SecondStockArticleWebServiceBL>().StockBookOrBookout(true, articleI3D: articleWithoutScanBarcode, stockI3D: 7, amount: 10, "Meine Schwester hat eine Tochter bekommen...", appUserI3D: 11));
var bookIn = this.WithSession(f => f.GetBL<ArticleStockWebServiceBL>().SearchArticleStockInfos(articleWithoutScanBarcodeFilter));
this.Verifier.Verify("8_bookIn", bookIn);
this.WithSession(f => f.GetBL<SecondStockArticleWebServiceBL>().StockBookOrBookout(false, articleI3D: articleWithoutScanBarcode, stockI3D: 7, amount: 5, "...Da wurde mein Wunsch nach einem Neffen zur Nichte gemacht", appUserI3D: 11));
var bookOut = this.WithSession(f => f.GetBL<ArticleStockWebServiceBL>().SearchArticleStockInfos(articleWithoutScanBarcodeFilter));
this.Verifier.Verify("9_bookOut", bookOut);
var articleMainStorage = new ArticleStockInfoFilter()
{
ArticleI3D = articleWithoutScanBarcode,
StockI3D = -1
};
this.WithSession(f => f.GetBL<SecondStockArticleWebServiceBL>().StockBookOrBookout(true, articleI3D: articleWithoutScanBarcode, stockI3D: -1, amount: 20, "Sagt ein Tischler zum anderen: 'Halt doch mal die Fräse'...", appUserI3D: 11));
var bookInMainStock = this.WithSession(f => f.GetBL<ArticleStockWebServiceBL>().SearchArticleStockInfos(articleMainStorage));
this.Verifier.Verify("10_bookInMainStock", bookInMainStock);
this.WithSession(f => f.GetBL<SecondStockArticleWebServiceBL>().StockBookOrBookout(false, articleI3D: articleWithoutScanBarcode, stockI3D: -1, amount: 5, "..., sagt der andere: 'Aber ich hab doch gar nix gesägt!'", appUserI3D: 11));
var bookOutMainStock = this.WithSession(f => f.GetBL<ArticleStockWebServiceBL>().SearchArticleStockInfos(articleMainStorage));
this.Verifier.Verify("11_bookOutMainStock", bookOutMainStock);
}
}
}