Files
Christoph Schwörer f045b99a25 Codebasis als Dateien ins Arbeitsrepo statt als Gitlink
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
2026-08-26 07:43:51 +02:00

82 lines
3.0 KiB
C#

using System.Collections.Generic;
using Centron.BusinessLogic;
using Centron.BusinessLogic.Administration.FileManagement;
using Centron.BusinessLogic.WebServices.Administration.FileManagement;
using Centron.Data.WebServices.Administration.FileManagement;
using Centron.Interfaces;
using Centron.Interfaces.Administration.Documents;
using Centron.Interfaces.BL;
using Centron.Tests.EndToEnd.Infrastructure;
using Xunit;
using Xunit.Abstractions;
namespace Centron.Tests.EndToEnd.Tests.Documents;
public class DocumentsCleanupTests : EndToEndTest
{
private int _referenceDirectoryI3D => 2093;
public DocumentsCleanupTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper)
{
}
public override void Execute()
{
int docI3D = 0;
for (int i = 0; i < 10; i++)
{
var resultI3D = AddDocumentToDirectory();
if (i == 4)
docI3D = resultI3D;
}
using var session = new BLSession();
var result = base.Sql<int>("SELECT COUNT(*) FROM Documents");
Assert.True(result == 10, $"Expected 10 document (currently existing:{result})");
result = session.GetBL<DocumentBL>().CleanupDocuments(6).ThrowIfError();
Assert.True(result == 0, $"Expected 0 deletes from 'CleanupDocuments' (got:{result})");
base.Sql($"UPDATE Documents SET OwnerDirI3D = NULL WHERE I3D <> {docI3D}");
result = session.GetBL<DocumentBL>().CleanupDocuments(6).ThrowIfError();
Assert.True(result == 6, $"Expected 6 deletes from 'CleanupDocuments' (got:{result})");
result = session.GetBL<DocumentBL>().CleanupDocuments(3).ThrowIfError();
Assert.True(result == 3, $"Expected 3 deletes from 'CleanupDocuments' (got:{result})");
result = base.Sql<int>("SELECT COUNT(*) FROM Documents");
Assert.True(result == 1, $"Expected 1 remaining document (got:{result})");
}
private int AddDocumentToDirectory()
{
using (var session = new BLSession())
{
var result = session.GetBL<DocumentWebServiceBL>().AddDocumentToDirectory(this.GetLoggedInUser(),
this._referenceDirectoryI3D,
new byte[]
{
1,2,3,4,5,6,7,8,10,11,12,13,14,15
},
"ibims1bildchen",
new List<DocumentMetaInformationDTO>
{
new DocumentMetaInformationDTO
{
Type = DocumentMetaInformationType.ReceiptNumber,
TypeName = "ibims1receiptnumber",
Value = "123"
},
new DocumentMetaInformationDTO
{
Type = DocumentMetaInformationType.SupplierI3D,
TypeName = "ibims1supplieri3d",
Value = "123"
}
}, fileObjectKind:CentronObjectKindNumeric.Chat);
return result.I3D;
}
}
}