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
101 lines
4.1 KiB
C#
101 lines
4.1 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Centron.BusinessLogic;
|
|
using Centron.BusinessLogic.EmployeeArea;
|
|
using Centron.BusinessLogic.Sales.Receipts.DataAndResults;
|
|
using Centron.BusinessLogic.Warehousing;
|
|
using Centron.BusinessLogic.WebServices.Sales.Receipts;
|
|
using Centron.BusinessLogic.WebServices.Warehousing;
|
|
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.Interfaces.Warehousing;
|
|
using Centron.Tests.EndToEnd.Infrastructure;
|
|
using Xunit;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace Centron.Tests.EndToEnd.TicketTests.Ticket119564
|
|
{
|
|
public class Ticket119564Tests : EndToEndTest
|
|
{
|
|
public Ticket119564Tests(ITestOutputHelper testOutputHelper)
|
|
: base(testOutputHelper)
|
|
{
|
|
}
|
|
|
|
public override void Execute()
|
|
{
|
|
// This test validates that the SaveReceipt method returns NegativeArticleStockBookings
|
|
// Article 4329 has a quantity of 1 in the database, and we want to create a delivery-list with 10 of it
|
|
// That means oldQuantity should be 1, newQuantity should be -9
|
|
|
|
var deliveryList = this.CreateDeliveryList();
|
|
|
|
using (var saveSession = new BLSession())
|
|
{
|
|
var user = saveSession.GetBL<AppUserBL>().GetAppUser(f => f.I3D == 11);
|
|
|
|
var saveResult = saveSession.GetBL<ReceiptWebServiceBL>().SaveReceipt(
|
|
deliveryList,
|
|
user,
|
|
new SaveReceiptData
|
|
{
|
|
IgnoreCallbacks = false, //Allow callbacks, because I want to check the negative-article-booking callback
|
|
InsertFreightArticle = false
|
|
},
|
|
autoLockIfNewReceipt: false,
|
|
CreatedThroughApplication.CentronNet,
|
|
receiptTemplateFolderI3D: null);
|
|
|
|
Assert.Equal(ResultStatus.Error, saveResult.Status);
|
|
this.Verifier.Verify("NegativeArticleBookings", saveResult.Data.NegativeArticleStockBookings);
|
|
}
|
|
}
|
|
|
|
private ReceiptDeliveryListDTO CreateDeliveryList()
|
|
{
|
|
const int ArticleI3D = 4329;
|
|
|
|
ReceiptDeliveryListDTO deliveryList;
|
|
using (var session = new BLSession())
|
|
{
|
|
var user = session.GetBL<AppUserBL>().GetAppUser(f => f.I3D == 11);
|
|
|
|
// Create delivery-list
|
|
var result = session.GetBL<ReceiptWebServiceBL>().CreateNewReceipt(
|
|
CentronObjectKindNumeric.DeliveryListClass,
|
|
new LoggedInUser(user),
|
|
customerI3D: 10022,
|
|
new CreateReceiptData(),
|
|
addressI3D: null,
|
|
contactPersonI3D: null,
|
|
insertSalutationAndAgreement: true,
|
|
ignoreDefaultContract: false,
|
|
insertCustomerDiscount: true);
|
|
|
|
// Create delivery-list-items
|
|
var receiptItem = session.GetBL<ReceiptItemWebServiceBL>().CreateArticleReceiptItems(
|
|
result.Data.Receipt,
|
|
isExternalArticle: false,
|
|
ArticleI3D,
|
|
externalArticleKind: null,
|
|
externalArticleId: null,
|
|
warehouseI3D: -1,
|
|
new LoggedInUser(user));
|
|
|
|
// Add items to delivery-list
|
|
deliveryList = (ReceiptDeliveryListDTO) result.Data.Receipt;
|
|
deliveryList.Items.AddRange(receiptItem.Data.ReceiptItems.Cast<ReceiptDeliveryListItemDTO>());
|
|
|
|
// Set quantity to more than available in the database, right now there is only 1 piece available
|
|
var articlePosition = deliveryList.Items.Single(f => f.ArticleI3D == ArticleI3D);
|
|
articlePosition.QuantityComplete = 10;
|
|
}
|
|
|
|
return deliveryList;
|
|
}
|
|
}
|
|
} |