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
94 lines
3.3 KiB
C#
94 lines
3.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Centron.BusinessLogic;
|
|
using Centron.BusinessLogic.EmployeeArea;
|
|
using Centron.BusinessLogic.WebServices.Sales.Receipts.ReceiptSearch;
|
|
using Centron.Data.Entities.Administration.Logins;
|
|
using Centron.Data.WebServices.Sales.Receipts.ReceiptSearch;
|
|
using Centron.Interfaces;
|
|
using Centron.Interfaces.Sales.Receipts.ReceiptSearch;
|
|
using Centron.Tests.EndToEnd.Infrastructure;
|
|
using Xunit;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace Centron.Tests.EndToEnd.TicketTests.Ticket144940;
|
|
|
|
public class Ticket144940Tests : EndToEndTest
|
|
{
|
|
public Ticket144940Tests(ITestOutputHelper testOutputHelper)
|
|
: base(testOutputHelper)
|
|
{
|
|
}
|
|
|
|
public const int InvoiceNumber = 40285;
|
|
public const int InvoiceI3D = 6578;
|
|
public const int InvoiceItemI3D = 25998;
|
|
public const string SecretText = "Geheimtextasdf";
|
|
|
|
public override void Execute()
|
|
{
|
|
this.PrepareDatabase();
|
|
|
|
// Ensure we can find the receipt
|
|
var filter = new ReceiptSearchFilter
|
|
{
|
|
ReceiptKinds = [CentronObjectKindNumeric.InvoiceClass],
|
|
IncludeClosedReceipts = true,
|
|
ReceiptNumber = InvoiceNumber,
|
|
};
|
|
this.SearchReceipts("FindInvoiceByNumber", filter, this.Validate);
|
|
|
|
// Now search with number and search-text
|
|
var filter2 = new ReceiptSearchFilter
|
|
{
|
|
ReceiptKinds = [CentronObjectKindNumeric.InvoiceClass],
|
|
IncludeClosedReceipts = true,
|
|
ReceiptNumber = InvoiceNumber,
|
|
SearchText = SecretText,
|
|
SearchInReceiptItemText = true,
|
|
};
|
|
this.SearchReceipts("FindInvoiceByNumberAndSecretText", filter2, this.Validate);
|
|
|
|
// Now only search-text
|
|
var filter3 = new ReceiptSearchFilter
|
|
{
|
|
ReceiptKinds = [CentronObjectKindNumeric.InvoiceClass],
|
|
IncludeClosedReceipts = true,
|
|
SearchText = SecretText,
|
|
SearchInReceiptItemText = true,
|
|
};
|
|
this.SearchReceipts("FindInvoiceBySecretText", filter3, this.Validate);
|
|
}
|
|
|
|
private void PrepareDatabase()
|
|
{
|
|
this.Sql($"UPDATE RechPos SET Bestellinformation = '{SecretText}' WHERE I3D = {InvoiceItemI3D}");
|
|
}
|
|
|
|
private void SearchReceipts(string name, ReceiptSearchFilter filter, Action<ReceiptSearchFilter, IList<ReceiptSearchItemDTO>> validate = null, LoggedInUser currentUser = null)
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
var user = currentUser ?? new LoggedInUser(session.GetBL<AppUserBL>().GetAppUser(f => f.I3D == 11));
|
|
var result = session.GetBL<ReceiptSearchWebServiceBL>().SearchReceipts(user, filter, 1, int.MaxValue);
|
|
|
|
this.Verifier.Verify($"Receipts_{name}", result);
|
|
|
|
validate?.Invoke(filter, result.Data.Result);
|
|
|
|
var duplicates = result.Data.Result
|
|
.GroupBy(f => new { f.ObjectKind, f.Number })
|
|
.Where(f => f.Count() > 1)
|
|
.ToList();
|
|
Assert.Empty(duplicates);
|
|
}
|
|
}
|
|
|
|
private void Validate(ReceiptSearchFilter filter, IList<ReceiptSearchItemDTO> dtos)
|
|
{
|
|
var invoice = Assert.Single(dtos);
|
|
Assert.Equal((int)CentronObjectKindNumeric.InvoiceClass, invoice.ObjectKind);
|
|
Assert.Equal(InvoiceI3D, invoice.I3D);
|
|
}
|
|
} |