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.3 KiB
C#
101 lines
4.3 KiB
C#
using Centron.BusinessLogic;
|
|
using Centron.BusinessLogic.Administration.Settings;
|
|
using Centron.BusinessLogic.EmployeeArea;
|
|
using Centron.BusinessLogic.Sales.Receipts.DataAndResults;
|
|
using Centron.BusinessLogic.WebServices.Sales.Receipts;
|
|
using Centron.BusinessLogic.WebServices.Sales.Receipts.DataAndResults;
|
|
using Centron.Data.Entities.Administration.Logins;
|
|
using Centron.Data.WebServices.Sales.Receipts.DeliveryLists;
|
|
using Centron.Data.WebServices.Sales.Receipts.Offers;
|
|
using Centron.Interfaces;
|
|
using Centron.Interfaces.Administration.Environment;
|
|
using Centron.Interfaces.BL;
|
|
using Centron.Tests.EndToEnd.Infrastructure;
|
|
using Xunit;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace Centron.Tests.EndToEnd.TicketTests.Ticket116289
|
|
{
|
|
public class Ticket116289Tests : EndToEndTest
|
|
{
|
|
public Ticket116289Tests(ITestOutputHelper testOutputHelper)
|
|
: base(testOutputHelper)
|
|
{
|
|
}
|
|
|
|
public override void Execute()
|
|
{
|
|
// This test verifies, that the variable-combobox-field in receipts works as expected, and the settings are checked
|
|
|
|
this.ExecuteMatrix(
|
|
new [] {true, false},
|
|
new [] {true, false},
|
|
new [] {true, false},
|
|
(active, required, withValue) =>
|
|
{
|
|
this.UpdateSettings(active, required);
|
|
|
|
var deliveryList = this.CreateDeliveryList();
|
|
deliveryList.VariableComboBoxFieldI3D = withValue ? 10 : null;
|
|
|
|
var saveResult = this.TrySaveDeliveryList(deliveryList);
|
|
|
|
this.Verifier.Verify($"SaveResult_Active_{active}_Required_{required}_WithValue_{withValue}", saveResult);
|
|
|
|
if (saveResult.Status is ResultStatus.Success)
|
|
{
|
|
this.AssertVariableComboBoxField(saveResult.Data.Receipt.I3D, deliveryList.VariableComboBoxFieldI3D);
|
|
}
|
|
});
|
|
}
|
|
|
|
private void UpdateSettings(bool active, bool required)
|
|
{
|
|
using var session = new BLSession();
|
|
|
|
var settings = session.GetBL<AppSettingsBL>().GetSettingsForUpdate(
|
|
AppSettingsConst.DeliveryListVariableDateField1Mandatory,
|
|
AppSettingsConst.DeliveryListVariableValuesFieldIsActive);
|
|
|
|
settings.UpdateBool(AppSettingsConst.DeliveryListVariableDateField1Mandatory, required);
|
|
settings.UpdateBool(AppSettingsConst.DeliveryListVariableValuesFieldIsActive, active);
|
|
|
|
settings.SaveSettings();
|
|
}
|
|
|
|
private ReceiptDeliveryListDTO CreateDeliveryList()
|
|
{
|
|
using var session = new BLSession();
|
|
|
|
var user = session.GetBL<AppUserBL>().GetAppUser(f => f.I3D == 11);
|
|
var result = session.GetBL<ReceiptWebServiceBL>().CreateNewReceipt(CentronObjectKindNumeric.DeliveryListClass, new LoggedInUser(user), 10022, new CreateReceiptData(), null, null, true, false, true);
|
|
|
|
var deliveryList = (ReceiptDeliveryListDTO)result.Data.Receipt;
|
|
|
|
deliveryList.VariableComboBoxFieldI3D = null;
|
|
|
|
return deliveryList;
|
|
}
|
|
|
|
private Result<SaveReceiptResultDTO> TrySaveDeliveryList(ReceiptDeliveryListDTO deliveryList)
|
|
{
|
|
using var session = new BLSession();
|
|
|
|
var user = session.GetBL<AppUserBL>().GetAppUser(f => f.I3D == 11);
|
|
var saveResult = session.GetBL<ReceiptWebServiceBL>().SaveReceipt(deliveryList, user, new SaveReceiptData
|
|
{
|
|
IgnoreCallbacks = false //We wanna validate that the callback for variable-combobox-field is called
|
|
}, false, CreatedThroughApplication.CentronNet, null);
|
|
|
|
return saveResult;
|
|
}
|
|
|
|
private void AssertVariableComboBoxField(int receipt3D, int? expectedVariableComboBoxFieldI3D)
|
|
{
|
|
using var session = new BLSession();
|
|
var deliveryList = (ReceiptDeliveryListDTO)session.GetBL<ReceiptWebServiceBL>().GetReceiptByI3D(receipt3D, CentronObjectKindNumeric.DeliveryListClass).ThrowIfError();
|
|
|
|
Assert.Equal(expectedVariableComboBoxFieldI3D, deliveryList.VariableComboBoxFieldI3D);
|
|
}
|
|
}
|
|
} |