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
92 lines
3.4 KiB
C#
92 lines
3.4 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Centron.BusinessLogic;
|
|
using Centron.BusinessLogic.Sales.Receipts.DataAndResults;
|
|
using Centron.BusinessLogic.Sales.Support;
|
|
using Centron.BusinessLogic.WebServices.Sales.Receipts;
|
|
using Centron.Data.WebServices.Sales.Receipts.Invoices;
|
|
using Centron.Interfaces;
|
|
using Centron.Interfaces.BL;
|
|
using Centron.Tests.EndToEnd.Infrastructure;
|
|
using Xunit;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace Centron.Tests.EndToEnd.TicketTests.Ticket136175;
|
|
|
|
public class Ticket136175Tests : EndToEndTest
|
|
{
|
|
public Ticket136175Tests(ITestOutputHelper testOutputHelper)
|
|
: base(testOutputHelper)
|
|
{
|
|
this.Verifier.Settings.IgnoreProperty<ReceiptInvoiceItemDTO>(f => f.BalanceID);
|
|
}
|
|
|
|
public const int CustomerI3D = 10010;
|
|
public const int ContractI3D = 25; // Is a contingent contract of customer 10010
|
|
|
|
public const int WorkItemBalanceArticleI3D = 111;
|
|
|
|
public override void Execute()
|
|
{
|
|
this.PrepareDatabase();
|
|
|
|
// In this ticket the problem was:
|
|
// That contract-contingent-balance-items were created for the work-item-balance-item
|
|
// That is incorrect, and we shouldn't create those contract-contingent-balance-items
|
|
|
|
var invoice = this.CreateNewInvoice();
|
|
invoice.ContractI3D = ContractI3D; //Assign contract, to make sure we get contingent-balance-items
|
|
|
|
var items = this.CreateItems(invoice);
|
|
|
|
this.Verifier.Verify("CreatedItems", items);
|
|
Assert.DoesNotContain(items, f => f.BalanceID is not null); //Assert that no balance-items were created
|
|
}
|
|
|
|
private void PrepareDatabase()
|
|
{
|
|
var helpdeskSettings = this.WithSession(s => s.GetBL<HelpdeskSettingsBL>().GetHelpdeskSettings());
|
|
helpdeskSettings.TimerBillingArticleWorkItemBalanceArticleI3D = WorkItemBalanceArticleI3D;
|
|
this.WithSession(s => s.GetBL<HelpdeskSettingsBL>().UpdateHelpdeskSettings(helpdeskSettings));
|
|
|
|
this.Sql($"DELETE FROM dbo.GroupToContingent");
|
|
this.Sql($"INSERT INTO dbo.GroupToContingent (ContractI3D, Kind, ElementI3D) VALUES (0, 1, 3)");
|
|
}
|
|
|
|
private ReceiptInvoiceDTO CreateNewInvoice()
|
|
{
|
|
using var session = new BLSession();
|
|
|
|
var createNewReceiptData = session.GetBL<ReceiptWebServiceBL>().CreateNewReceipt(
|
|
CentronObjectKindNumeric.InvoiceClass,
|
|
this.GetLoggedInUser(),
|
|
CustomerI3D,
|
|
new CreateReceiptData
|
|
{
|
|
IgnoreCallbacks = true
|
|
},
|
|
addressI3D: null,
|
|
contactPersonI3D: null,
|
|
insertSalutationAndAgreement: false,
|
|
ignoreDefaultContract: true,
|
|
insertCustomerDiscount: false).ThrowIfError();
|
|
|
|
return (ReceiptInvoiceDTO)createNewReceiptData.Receipt;
|
|
}
|
|
|
|
private List<ReceiptInvoiceItemDTO> CreateItems(ReceiptInvoiceDTO invoice)
|
|
{
|
|
using var session = new BLSession();
|
|
|
|
var itemsResult = session.GetBL<ReceiptItemWebServiceBL>().CreateArticleReceiptItems(
|
|
invoice,
|
|
isExternalArticle: false,
|
|
WorkItemBalanceArticleI3D,
|
|
externalArticleKind: null,
|
|
externalArticleId: null,
|
|
warehouseI3D: -1, //Use main warehouse
|
|
this.GetLoggedInUser()).ThrowIfError();
|
|
|
|
return itemsResult.ReceiptItems.Cast<ReceiptInvoiceItemDTO>().ToList();
|
|
}
|
|
} |