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
111 lines
4.8 KiB
C#
111 lines
4.8 KiB
C#
using System.Linq;
|
|
using System.Text;
|
|
using Centron.BusinessLogic;
|
|
using Centron.BusinessLogic.EmployeeArea;
|
|
using Centron.BusinessLogic.Sales.Receipts.DataAndResults;
|
|
using Centron.BusinessLogic.WebServices.Sales.Receipts;
|
|
using Centron.DAO.AdoNETDataAccess;
|
|
using Centron.Data.Entities.Administration.Logins;
|
|
using Centron.Data.WebServices.Sales.Receipts.DeliveryLists;
|
|
using Centron.Interfaces;
|
|
using Centron.Interfaces.Administration.Environment;
|
|
using Centron.Interfaces.BL;
|
|
using Centron.Interfaces.Sales.Receipts;
|
|
using Centron.Tests.EndToEnd.Infrastructure;
|
|
using Xunit;
|
|
using Xunit.Abstractions;
|
|
using Centron.Core.Extensions;
|
|
|
|
namespace Centron.Tests.EndToEnd.TicketTests.Ticket116468
|
|
{
|
|
public class Ticket116468Test : EndToEndTest
|
|
{
|
|
public Ticket116468Test(ITestOutputHelper testOutputHelper)
|
|
: base(testOutputHelper)
|
|
{
|
|
this.Verifier.Settings.IgnoreColumn("Datum");
|
|
}
|
|
|
|
public override void Execute()
|
|
{
|
|
this.CreateDeliveryListWith(articleI3D: 19, quantity: 10);
|
|
this.CreateDeliveryListWith(articleI3D: 19, quantity: 5);
|
|
|
|
this.CreateDeliveryListWith(articleI3D: 1256, barcodes:new []{"100032017", "100062017", "100092017", "100102017"});
|
|
this.CreateDeliveryListWith(articleI3D: 176, barcodes:new []{"300500", "741852", "asdfjdsfklasdklöf"});
|
|
this.CreateDeliveryListWith(articleI3D: 158, barcodes:new []{"11849848", "12189489", "15165847", "1541874189"});
|
|
}
|
|
|
|
private void CreateDeliveryListWith(int articleI3D, decimal? quantity = null, string[] barcodes = null)
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
// Create delivery-list
|
|
var user = session.GetBL<AppUserBL>().GetAppUser(f => f.I3D == 11);
|
|
var result = session.GetBL<ReceiptWebServiceBL>().CreateNewReceipt(CentronObjectKindNumeric.DeliveryListClass, new LoggedInUser(user), 10020, new CreateReceiptData(), null, null, true, false, true);
|
|
|
|
var deliveryList = (ReceiptDeliveryListDTO)result.Data.Receipt;
|
|
|
|
// Create article receipt-items
|
|
var receiptItemsResult = session.GetBL<ReceiptItemWebServiceBL>().CreateArticleReceiptItems(
|
|
deliveryList,
|
|
isExternalArticle:false,
|
|
articleI3D,
|
|
externalArticleKind:null,
|
|
externalArticleId:null,
|
|
warehouseI3D: -1,
|
|
new Data.Entities.Administration.Logins.LoggedInUser(user));
|
|
|
|
var items = receiptItemsResult.Data.ReceiptItems.Cast<ReceiptDeliveryListItemDTO>().ToList();
|
|
deliveryList.Items.AddRange(items);
|
|
var articleItem = items.First(f => f.ArticleI3D == articleI3D);
|
|
|
|
// Set quantity and barcodes (if given any)
|
|
articleItem.QuantityComplete = quantity;
|
|
if (barcodes != null)
|
|
{
|
|
articleItem.Barcodes.AddRange(barcodes.Select(f => new ReceiptItemBarcode
|
|
{
|
|
BarcodeI3D = this.Sql<int>("SELECT B.I3D FROM dbo.Barcode B WHERE B.Barcode = @Barcode", d => d.AddParameter("Barcode", f)),
|
|
BarcodeCaption = f,
|
|
IsActive = true
|
|
}));
|
|
|
|
articleItem.QuantityComplete = barcodes.Length;
|
|
}
|
|
|
|
// Save delivery-list
|
|
using (var saveSession = new BLSession())
|
|
{
|
|
var saveResult = saveSession.GetBL<ReceiptWebServiceBL>().SaveReceipt(
|
|
deliveryList,
|
|
user,
|
|
new SaveReceiptData {IgnoreCallbacks = true},
|
|
autoLockIfNewReceipt: false,
|
|
CreatedThroughApplication.CentronNet,
|
|
receiptTemplateFolderI3D: null);
|
|
|
|
Assert.Equal(ResultStatus.Success, saveResult.Status);
|
|
Assert.NotNull(saveResult.Data.Receipt);
|
|
}
|
|
|
|
// Validate the log
|
|
string GetVerifyName()
|
|
{
|
|
var name = new StringBuilder();
|
|
name.Append("Article");
|
|
name.Append(articleI3D);
|
|
name.Append("_Book");
|
|
name.Append(articleItem.QuantityComplete.GetValueOrDefault().ToDisplayString());
|
|
|
|
if (barcodes != null)
|
|
name.Append("_Barcodes");
|
|
|
|
return name.ToString();
|
|
}
|
|
|
|
this.Verifier.VerifyTable(GetVerifyName(), "dbo.ARTIKlog", $"ArtikelI3D = {articleI3D}");
|
|
}
|
|
}
|
|
}
|
|
} |