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
This commit is contained in:
Christoph Schwörer
2026-08-26 07:43:51 +02:00
parent 18edae75b6
commit f045b99a25
24664 changed files with 5846716 additions and 1 deletions
@@ -0,0 +1,5 @@
[
'ua',
'?.!bkalsdfj',
'japanesesentence'
]
@@ -0,0 +1,77 @@
{
Attachment: 0,
ChangedBy: {
Availability: 0,
BranchI3D: 0,
DefaultStorageI3D: null,
Dispatcher: false,
DisplayText: 'c-entron Administrator',
Email: null,
Employeenumber: null,
FirstName: 'c-entron',
FullName: 'Administrator, c-entron (ADMIN)',
I3D: 22,
IsActive: false,
LastAvailabilityChange: null,
LastName: 'Administrator',
LeavingDate: null,
Phone1: null,
RemainingDaysOfVacation: 0.0,
ShortSign: 'ADMIN',
State: null,
SupportLevel: null,
Template1: false,
Template2: false,
Template3: false,
Template4: false,
VacationEntitlement: 0.0
},
ChangedDate: DateTime,
CreatedBy: {
Availability: 0,
BranchI3D: 0,
DefaultStorageI3D: null,
Dispatcher: false,
DisplayText: 'c-entron Administrator',
Email: null,
Employeenumber: null,
FirstName: 'c-entron',
FullName: 'Administrator, c-entron (ADMIN)',
I3D: 22,
IsActive: false,
LastAvailabilityChange: null,
LastName: 'Administrator',
LeavingDate: null,
Phone1: null,
RemainingDaysOfVacation: 0.0,
ShortSign: 'ADMIN',
State: null,
SupportLevel: null,
Template1: false,
Template2: false,
Template3: false,
Template4: false,
VacationEntitlement: 0.0
},
CreatedDate: DateTime,
DMSSyncDate: null,
DMSSyncEmployeeI3D: null,
DMSSyncType: null,
DMSSyncUniqueID: null,
DocumentReferenceObjectKind: 7600089,
DocumentSize: 14,
FileData: 'AQIDBAUGBwgKCwwNDg8=',
Flags: 0,
HelpdeskHistoryI3D: null,
I3D: 7423,
LockedBy: null,
LockedByWorkstation: null,
LockedFilePath: null,
MetaInformations: null,
Name: 'ibims1bildchen',
ParentDirectoryI3D: 2093,
PublicDelete: false,
ThumbnailI3D: null,
UploadedByContactI3D: null,
Version: 1
}
@@ -0,0 +1,77 @@
{
Attachment: 0,
ChangedBy: {
Availability: 0,
BranchI3D: 0,
DefaultStorageI3D: null,
Dispatcher: false,
DisplayText: 'c-entron Administrator',
Email: null,
Employeenumber: null,
FirstName: 'c-entron',
FullName: 'Administrator, c-entron (ADMIN)',
I3D: 22,
IsActive: false,
LastAvailabilityChange: null,
LastName: 'Administrator',
LeavingDate: null,
Phone1: null,
RemainingDaysOfVacation: 0.0,
ShortSign: 'ADMIN',
State: null,
SupportLevel: null,
Template1: false,
Template2: false,
Template3: false,
Template4: false,
VacationEntitlement: 0.0
},
ChangedDate: DateTime,
CreatedBy: {
Availability: 0,
BranchI3D: 0,
DefaultStorageI3D: null,
Dispatcher: false,
DisplayText: 'c-entron Administrator',
Email: null,
Employeenumber: null,
FirstName: 'c-entron',
FullName: 'Administrator, c-entron (ADMIN)',
I3D: 22,
IsActive: false,
LastAvailabilityChange: null,
LastName: 'Administrator',
LeavingDate: null,
Phone1: null,
RemainingDaysOfVacation: 0.0,
ShortSign: 'ADMIN',
State: null,
SupportLevel: null,
Template1: false,
Template2: false,
Template3: false,
Template4: false,
VacationEntitlement: 0.0
},
CreatedDate: DateTime,
DMSSyncDate: null,
DMSSyncEmployeeI3D: null,
DMSSyncType: null,
DMSSyncUniqueID: null,
DocumentReferenceObjectKind: 0,
DocumentSize: 20,
FileData: 'AAAAAAAAAAAAAAAAAAAAAAAAAAA=',
Flags: 0,
HelpdeskHistoryI3D: null,
I3D: 7427,
LockedBy: null,
LockedByWorkstation: null,
LockedFilePath: null,
MetaInformations: null,
Name: 'ibims1document',
ParentDirectoryI3D: 2093,
PublicDelete: false,
ThumbnailI3D: null,
UploadedByContactI3D: null,
Version: 3
}
@@ -0,0 +1,102 @@
{
Attachment: 0,
ChangedBy: {
Availability: 0,
BranchI3D: 0,
DefaultStorageI3D: null,
Dispatcher: false,
DisplayText: 'c-entron Administrator',
Email: null,
Employeenumber: null,
FirstName: 'c-entron',
FullName: 'Administrator, c-entron (ADMIN)',
I3D: 22,
IsActive: false,
LastAvailabilityChange: null,
LastName: 'Administrator',
LeavingDate: null,
Phone1: null,
RemainingDaysOfVacation: 0.0,
ShortSign: 'ADMIN',
State: null,
SupportLevel: null,
Template1: false,
Template2: false,
Template3: false,
Template4: false,
VacationEntitlement: 0.0
},
ChangedDate: DateTime,
CreatedBy: {
Availability: 0,
BranchI3D: 0,
DefaultStorageI3D: null,
Dispatcher: false,
DisplayText: 'c-entron Administrator',
Email: null,
Employeenumber: null,
FirstName: 'c-entron',
FullName: 'Administrator, c-entron (ADMIN)',
I3D: 22,
IsActive: false,
LastAvailabilityChange: null,
LastName: 'Administrator',
LeavingDate: null,
Phone1: null,
RemainingDaysOfVacation: 0.0,
ShortSign: 'ADMIN',
State: null,
SupportLevel: null,
Template1: false,
Template2: false,
Template3: false,
Template4: false,
VacationEntitlement: 0.0
},
CreatedDate: DateTime,
DMSSyncDate: null,
DMSSyncEmployeeI3D: null,
DMSSyncType: null,
DMSSyncUniqueID: null,
DocumentReferenceObjectKind: 0,
DocumentSize: 9,
FileData: 'AQIDBAUGBwgK',
Flags: 0,
HelpdeskHistoryI3D: null,
I3D: 7426,
LockedBy: {
Availability: 0,
BranchI3D: 0,
DefaultStorageI3D: null,
Dispatcher: false,
DisplayText: 'c-entron Administrator',
Email: null,
Employeenumber: null,
FirstName: 'c-entron',
FullName: 'Administrator, c-entron (ADMIN)',
I3D: 22,
IsActive: false,
LastAvailabilityChange: null,
LastName: 'Administrator',
LeavingDate: null,
Phone1: null,
RemainingDaysOfVacation: 0.0,
ShortSign: 'ADMIN',
State: null,
SupportLevel: null,
Template1: false,
Template2: false,
Template3: false,
Template4: false,
VacationEntitlement: 0.0
},
LockedByWorkstation: 'ibims1workstation',
LockedFilePath: 'ibims1dateipfad',
MetaInformations: null,
Name: 'ibims1document',
ParentDirectoryI3D: 2093,
PublicDelete: false,
ThumbnailI3D: null,
UploadedByContactI3D: null,
Version: 2
}
@@ -0,0 +1,77 @@
{
Attachment: 0,
ChangedBy: {
Availability: 0,
BranchI3D: 0,
DefaultStorageI3D: null,
Dispatcher: false,
DisplayText: 'c-entron Administrator',
Email: null,
Employeenumber: null,
FirstName: 'c-entron',
FullName: 'Administrator, c-entron (ADMIN)',
I3D: 22,
IsActive: false,
LastAvailabilityChange: null,
LastName: 'Administrator',
LeavingDate: null,
Phone1: null,
RemainingDaysOfVacation: 0.0,
ShortSign: 'ADMIN',
State: null,
SupportLevel: null,
Template1: false,
Template2: false,
Template3: false,
Template4: false,
VacationEntitlement: 0.0
},
ChangedDate: DateTime,
CreatedBy: {
Availability: 0,
BranchI3D: 0,
DefaultStorageI3D: null,
Dispatcher: false,
DisplayText: 'c-entron Administrator',
Email: null,
Employeenumber: null,
FirstName: 'c-entron',
FullName: 'Administrator, c-entron (ADMIN)',
I3D: 22,
IsActive: false,
LastAvailabilityChange: null,
LastName: 'Administrator',
LeavingDate: null,
Phone1: null,
RemainingDaysOfVacation: 0.0,
ShortSign: 'ADMIN',
State: null,
SupportLevel: null,
Template1: false,
Template2: false,
Template3: false,
Template4: false,
VacationEntitlement: 0.0
},
CreatedDate: DateTime,
DMSSyncDate: null,
DMSSyncEmployeeI3D: null,
DMSSyncType: null,
DMSSyncUniqueID: null,
DocumentReferenceObjectKind: 0,
DocumentSize: 20,
FileData: 'AAAAAAAAAAAAAAAAAAAAAAAAAAA=',
Flags: 0,
HelpdeskHistoryI3D: null,
I3D: 7427,
LockedBy: null,
LockedByWorkstation: null,
LockedFilePath: null,
MetaInformations: null,
Name: 'ibims1document',
ParentDirectoryI3D: 2093,
PublicDelete: false,
ThumbnailI3D: null,
UploadedByContactI3D: null,
Version: 3
}
@@ -0,0 +1,77 @@
{
Attachment: 0,
ChangedBy: {
Availability: 0,
BranchI3D: 0,
DefaultStorageI3D: null,
Dispatcher: false,
DisplayText: 'c-entron Administrator',
Email: null,
Employeenumber: null,
FirstName: 'c-entron',
FullName: 'Administrator, c-entron (ADMIN)',
I3D: 22,
IsActive: false,
LastAvailabilityChange: null,
LastName: 'Administrator',
LeavingDate: null,
Phone1: null,
RemainingDaysOfVacation: 0.0,
ShortSign: 'ADMIN',
State: null,
SupportLevel: null,
Template1: false,
Template2: false,
Template3: false,
Template4: false,
VacationEntitlement: 0.0
},
ChangedDate: DateTime,
CreatedBy: {
Availability: 0,
BranchI3D: 0,
DefaultStorageI3D: null,
Dispatcher: false,
DisplayText: 'c-entron Administrator',
Email: null,
Employeenumber: null,
FirstName: 'c-entron',
FullName: 'Administrator, c-entron (ADMIN)',
I3D: 22,
IsActive: false,
LastAvailabilityChange: null,
LastName: 'Administrator',
LeavingDate: null,
Phone1: null,
RemainingDaysOfVacation: 0.0,
ShortSign: 'ADMIN',
State: null,
SupportLevel: null,
Template1: false,
Template2: false,
Template3: false,
Template4: false,
VacationEntitlement: 0.0
},
CreatedDate: DateTime,
DMSSyncDate: null,
DMSSyncEmployeeI3D: null,
DMSSyncType: null,
DMSSyncUniqueID: null,
DocumentReferenceObjectKind: 0,
DocumentSize: 14,
FileData: 'AQIDBAUGBwgKCwwNDg8=',
Flags: 0,
HelpdeskHistoryI3D: null,
I3D: 7424,
LockedBy: null,
LockedByWorkstation: null,
LockedFilePath: null,
MetaInformations: null,
Name: 'yeshälloümööf',
ParentDirectoryI3D: 2093,
PublicDelete: false,
ThumbnailI3D: null,
UploadedByContactI3D: null,
Version: 1
}
@@ -0,0 +1,239 @@
{
Data: [
{
Attachment: 0,
ChangedBy: {
Availability: 0,
BranchI3D: 0,
DefaultStorageI3D: null,
Dispatcher: false,
DisplayText: 'c-entron Administrator',
Email: null,
Employeenumber: null,
FirstName: 'c-entron',
FullName: 'Administrator, c-entron (ADMIN)',
I3D: 22,
IsActive: false,
LastAvailabilityChange: null,
LastName: 'Administrator',
LeavingDate: null,
Phone1: null,
RemainingDaysOfVacation: 0.0,
ShortSign: 'ADMIN',
State: null,
SupportLevel: null,
Template1: false,
Template2: false,
Template3: false,
Template4: false,
VacationEntitlement: 0.0
},
ChangedDate: DateTime,
CreatedBy: {
Availability: 0,
BranchI3D: 0,
DefaultStorageI3D: null,
Dispatcher: false,
DisplayText: 'c-entron Administrator',
Email: null,
Employeenumber: null,
FirstName: 'c-entron',
FullName: 'Administrator, c-entron (ADMIN)',
I3D: 22,
IsActive: false,
LastAvailabilityChange: null,
LastName: 'Administrator',
LeavingDate: null,
Phone1: null,
RemainingDaysOfVacation: 0.0,
ShortSign: 'ADMIN',
State: null,
SupportLevel: null,
Template1: false,
Template2: false,
Template3: false,
Template4: false,
VacationEntitlement: 0.0
},
CreatedDate: DateTime,
DMSSyncDate: null,
DMSSyncEmployeeI3D: null,
DMSSyncType: null,
DMSSyncUniqueID: null,
DocumentReferenceObjectKind: 7600089,
DocumentSize: 14,
FileData: null,
Flags: 0,
HelpdeskHistoryI3D: null,
I3D: 7423,
LockedBy: null,
LockedByWorkstation: null,
LockedFilePath: null,
MetaInformations: null,
Name: 'ibims1bildchen',
ParentDirectoryI3D: 2093,
PublicDelete: false,
ThumbnailI3D: null,
UploadedByContactI3D: null,
Version: 1
},
{
Attachment: 0,
ChangedBy: {
Availability: 0,
BranchI3D: 0,
DefaultStorageI3D: null,
Dispatcher: false,
DisplayText: 'c-entron Administrator',
Email: null,
Employeenumber: null,
FirstName: 'c-entron',
FullName: 'Administrator, c-entron (ADMIN)',
I3D: 22,
IsActive: false,
LastAvailabilityChange: null,
LastName: 'Administrator',
LeavingDate: null,
Phone1: null,
RemainingDaysOfVacation: 0.0,
ShortSign: 'ADMIN',
State: null,
SupportLevel: null,
Template1: false,
Template2: false,
Template3: false,
Template4: false,
VacationEntitlement: 0.0
},
ChangedDate: DateTime,
CreatedBy: {
Availability: 0,
BranchI3D: 0,
DefaultStorageI3D: null,
Dispatcher: false,
DisplayText: 'c-entron Administrator',
Email: null,
Employeenumber: null,
FirstName: 'c-entron',
FullName: 'Administrator, c-entron (ADMIN)',
I3D: 22,
IsActive: false,
LastAvailabilityChange: null,
LastName: 'Administrator',
LeavingDate: null,
Phone1: null,
RemainingDaysOfVacation: 0.0,
ShortSign: 'ADMIN',
State: null,
SupportLevel: null,
Template1: false,
Template2: false,
Template3: false,
Template4: false,
VacationEntitlement: 0.0
},
CreatedDate: DateTime,
DMSSyncDate: null,
DMSSyncEmployeeI3D: null,
DMSSyncType: null,
DMSSyncUniqueID: null,
DocumentReferenceObjectKind: 0,
DocumentSize: 14,
FileData: null,
Flags: 0,
HelpdeskHistoryI3D: null,
I3D: 7424,
LockedBy: null,
LockedByWorkstation: null,
LockedFilePath: null,
MetaInformations: null,
Name: 'yeshälloümööf',
ParentDirectoryI3D: 2093,
PublicDelete: false,
ThumbnailI3D: null,
UploadedByContactI3D: null,
Version: 1
},
{
Attachment: 0,
ChangedBy: {
Availability: 0,
BranchI3D: 0,
DefaultStorageI3D: null,
Dispatcher: false,
DisplayText: 'c-entron Administrator',
Email: null,
Employeenumber: null,
FirstName: 'c-entron',
FullName: 'Administrator, c-entron (ADMIN)',
I3D: 22,
IsActive: false,
LastAvailabilityChange: null,
LastName: 'Administrator',
LeavingDate: null,
Phone1: null,
RemainingDaysOfVacation: 0.0,
ShortSign: 'ADMIN',
State: null,
SupportLevel: null,
Template1: false,
Template2: false,
Template3: false,
Template4: false,
VacationEntitlement: 0.0
},
ChangedDate: DateTime,
CreatedBy: {
Availability: 0,
BranchI3D: 0,
DefaultStorageI3D: null,
Dispatcher: false,
DisplayText: 'c-entron Administrator',
Email: null,
Employeenumber: null,
FirstName: 'c-entron',
FullName: 'Administrator, c-entron (ADMIN)',
I3D: 22,
IsActive: false,
LastAvailabilityChange: null,
LastName: 'Administrator',
LeavingDate: null,
Phone1: null,
RemainingDaysOfVacation: 0.0,
ShortSign: 'ADMIN',
State: null,
SupportLevel: null,
Template1: false,
Template2: false,
Template3: false,
Template4: false,
VacationEntitlement: 0.0
},
CreatedDate: DateTime,
DMSSyncDate: null,
DMSSyncEmployeeI3D: null,
DMSSyncType: null,
DMSSyncUniqueID: null,
DocumentReferenceObjectKind: 2,
DocumentSize: 14,
FileData: null,
Flags: 0,
HelpdeskHistoryI3D: null,
I3D: 7425,
LockedBy: null,
LockedByWorkstation: null,
LockedFilePath: null,
MetaInformations: null,
Name: 'ibims2bildchen',
ParentDirectoryI3D: 2093,
PublicDelete: false,
ThumbnailI3D: null,
UploadedByContactI3D: null,
Version: 1
}
],
Error: null,
Message: null,
MessageCode: null,
Status: 0
}
@@ -0,0 +1,162 @@
{
Data: [
{
Attachment: 0,
ChangedBy: {
Availability: 0,
BranchI3D: 0,
DefaultStorageI3D: null,
Dispatcher: false,
DisplayText: 'c-entron Administrator',
Email: null,
Employeenumber: null,
FirstName: 'c-entron',
FullName: 'Administrator, c-entron (ADMIN)',
I3D: 22,
IsActive: false,
LastAvailabilityChange: null,
LastName: 'Administrator',
LeavingDate: null,
Phone1: null,
RemainingDaysOfVacation: 0.0,
ShortSign: 'ADMIN',
State: null,
SupportLevel: null,
Template1: false,
Template2: false,
Template3: false,
Template4: false,
VacationEntitlement: 0.0
},
ChangedDate: DateTime,
CreatedBy: {
Availability: 0,
BranchI3D: 0,
DefaultStorageI3D: null,
Dispatcher: false,
DisplayText: 'c-entron Administrator',
Email: null,
Employeenumber: null,
FirstName: 'c-entron',
FullName: 'Administrator, c-entron (ADMIN)',
I3D: 22,
IsActive: false,
LastAvailabilityChange: null,
LastName: 'Administrator',
LeavingDate: null,
Phone1: null,
RemainingDaysOfVacation: 0.0,
ShortSign: 'ADMIN',
State: null,
SupportLevel: null,
Template1: false,
Template2: false,
Template3: false,
Template4: false,
VacationEntitlement: 0.0
},
CreatedDate: DateTime,
DMSSyncDate: null,
DMSSyncEmployeeI3D: null,
DMSSyncType: null,
DMSSyncUniqueID: null,
DocumentReferenceObjectKind: 0,
DocumentSize: 14,
FileData: null,
Flags: 0,
HelpdeskHistoryI3D: null,
I3D: 7424,
LockedBy: null,
LockedByWorkstation: null,
LockedFilePath: null,
MetaInformations: null,
Name: 'yeshälloümööf',
ParentDirectoryI3D: 2093,
PublicDelete: false,
ThumbnailI3D: null,
UploadedByContactI3D: null,
Version: 1
},
{
Attachment: 0,
ChangedBy: {
Availability: 0,
BranchI3D: 0,
DefaultStorageI3D: null,
Dispatcher: false,
DisplayText: 'c-entron Administrator',
Email: null,
Employeenumber: null,
FirstName: 'c-entron',
FullName: 'Administrator, c-entron (ADMIN)',
I3D: 22,
IsActive: false,
LastAvailabilityChange: null,
LastName: 'Administrator',
LeavingDate: null,
Phone1: null,
RemainingDaysOfVacation: 0.0,
ShortSign: 'ADMIN',
State: null,
SupportLevel: null,
Template1: false,
Template2: false,
Template3: false,
Template4: false,
VacationEntitlement: 0.0
},
ChangedDate: DateTime,
CreatedBy: {
Availability: 0,
BranchI3D: 0,
DefaultStorageI3D: null,
Dispatcher: false,
DisplayText: 'c-entron Administrator',
Email: null,
Employeenumber: null,
FirstName: 'c-entron',
FullName: 'Administrator, c-entron (ADMIN)',
I3D: 22,
IsActive: false,
LastAvailabilityChange: null,
LastName: 'Administrator',
LeavingDate: null,
Phone1: null,
RemainingDaysOfVacation: 0.0,
ShortSign: 'ADMIN',
State: null,
SupportLevel: null,
Template1: false,
Template2: false,
Template3: false,
Template4: false,
VacationEntitlement: 0.0
},
CreatedDate: DateTime,
DMSSyncDate: null,
DMSSyncEmployeeI3D: null,
DMSSyncType: null,
DMSSyncUniqueID: null,
DocumentReferenceObjectKind: 2,
DocumentSize: 14,
FileData: null,
Flags: 0,
HelpdeskHistoryI3D: null,
I3D: 7425,
LockedBy: null,
LockedByWorkstation: null,
LockedFilePath: null,
MetaInformations: null,
Name: 'ibims2bildchen',
ParentDirectoryI3D: 2093,
PublicDelete: false,
ThumbnailI3D: null,
UploadedByContactI3D: null,
Version: 1
}
],
Error: null,
Message: null,
MessageCode: null,
Status: 0
}
@@ -0,0 +1,82 @@
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;
}
}
}
@@ -0,0 +1,233 @@
[
{
Attachment: 0,
ChangedBy: {
Availability: 0,
BranchI3D: 0,
DefaultStorageI3D: null,
Dispatcher: false,
DisplayText: 'c-entron Administrator',
Email: null,
Employeenumber: null,
FirstName: 'c-entron',
FullName: 'Administrator, c-entron (ADMIN)',
I3D: 22,
IsActive: false,
LastAvailabilityChange: null,
LastName: 'Administrator',
LeavingDate: null,
Phone1: null,
RemainingDaysOfVacation: 0.0,
ShortSign: 'ADMIN',
State: null,
SupportLevel: null,
Template1: false,
Template2: false,
Template3: false,
Template4: false,
VacationEntitlement: 0.0
},
ChangedDate: DateTime,
CreatedBy: {
Availability: 0,
BranchI3D: 0,
DefaultStorageI3D: null,
Dispatcher: false,
DisplayText: 'c-entron Administrator',
Email: null,
Employeenumber: null,
FirstName: 'c-entron',
FullName: 'Administrator, c-entron (ADMIN)',
I3D: 22,
IsActive: false,
LastAvailabilityChange: null,
LastName: 'Administrator',
LeavingDate: null,
Phone1: null,
RemainingDaysOfVacation: 0.0,
ShortSign: 'ADMIN',
State: null,
SupportLevel: null,
Template1: false,
Template2: false,
Template3: false,
Template4: false,
VacationEntitlement: 0.0
},
CreatedDate: DateTime,
DMSSyncDate: null,
DMSSyncEmployeeI3D: null,
DMSSyncType: null,
DMSSyncUniqueID: null,
DocumentReferenceObjectKind: 7600089,
DocumentSize: 14,
FileData: null,
Flags: 0,
HelpdeskHistoryI3D: null,
I3D: 7423,
LockedBy: null,
LockedByWorkstation: null,
LockedFilePath: null,
MetaInformations: null,
Name: 'ibims1bildchen',
ParentDirectoryI3D: 2093,
PublicDelete: false,
ThumbnailI3D: null,
UploadedByContactI3D: null,
Version: 1
},
{
Attachment: 0,
ChangedBy: {
Availability: 0,
BranchI3D: 0,
DefaultStorageI3D: null,
Dispatcher: false,
DisplayText: 'c-entron Administrator',
Email: null,
Employeenumber: null,
FirstName: 'c-entron',
FullName: 'Administrator, c-entron (ADMIN)',
I3D: 22,
IsActive: false,
LastAvailabilityChange: null,
LastName: 'Administrator',
LeavingDate: null,
Phone1: null,
RemainingDaysOfVacation: 0.0,
ShortSign: 'ADMIN',
State: null,
SupportLevel: null,
Template1: false,
Template2: false,
Template3: false,
Template4: false,
VacationEntitlement: 0.0
},
ChangedDate: DateTime,
CreatedBy: {
Availability: 0,
BranchI3D: 0,
DefaultStorageI3D: null,
Dispatcher: false,
DisplayText: 'c-entron Administrator',
Email: null,
Employeenumber: null,
FirstName: 'c-entron',
FullName: 'Administrator, c-entron (ADMIN)',
I3D: 22,
IsActive: false,
LastAvailabilityChange: null,
LastName: 'Administrator',
LeavingDate: null,
Phone1: null,
RemainingDaysOfVacation: 0.0,
ShortSign: 'ADMIN',
State: null,
SupportLevel: null,
Template1: false,
Template2: false,
Template3: false,
Template4: false,
VacationEntitlement: 0.0
},
CreatedDate: DateTime,
DMSSyncDate: null,
DMSSyncEmployeeI3D: null,
DMSSyncType: null,
DMSSyncUniqueID: null,
DocumentReferenceObjectKind: 2,
DocumentSize: 14,
FileData: null,
Flags: 0,
HelpdeskHistoryI3D: null,
I3D: 7425,
LockedBy: null,
LockedByWorkstation: null,
LockedFilePath: null,
MetaInformations: null,
Name: 'ibims2bildchen',
ParentDirectoryI3D: 2093,
PublicDelete: false,
ThumbnailI3D: null,
UploadedByContactI3D: null,
Version: 1
},
{
Attachment: 0,
ChangedBy: {
Availability: 0,
BranchI3D: 0,
DefaultStorageI3D: null,
Dispatcher: false,
DisplayText: 'c-entron Administrator',
Email: null,
Employeenumber: null,
FirstName: 'c-entron',
FullName: 'Administrator, c-entron (ADMIN)',
I3D: 22,
IsActive: false,
LastAvailabilityChange: null,
LastName: 'Administrator',
LeavingDate: null,
Phone1: null,
RemainingDaysOfVacation: 0.0,
ShortSign: 'ADMIN',
State: null,
SupportLevel: null,
Template1: false,
Template2: false,
Template3: false,
Template4: false,
VacationEntitlement: 0.0
},
ChangedDate: DateTime,
CreatedBy: {
Availability: 0,
BranchI3D: 0,
DefaultStorageI3D: null,
Dispatcher: false,
DisplayText: 'c-entron Administrator',
Email: null,
Employeenumber: null,
FirstName: 'c-entron',
FullName: 'Administrator, c-entron (ADMIN)',
I3D: 22,
IsActive: false,
LastAvailabilityChange: null,
LastName: 'Administrator',
LeavingDate: null,
Phone1: null,
RemainingDaysOfVacation: 0.0,
ShortSign: 'ADMIN',
State: null,
SupportLevel: null,
Template1: false,
Template2: false,
Template3: false,
Template4: false,
VacationEntitlement: 0.0
},
CreatedDate: DateTime,
DMSSyncDate: null,
DMSSyncEmployeeI3D: null,
DMSSyncType: null,
DMSSyncUniqueID: null,
DocumentReferenceObjectKind: 0,
DocumentSize: 14,
FileData: null,
Flags: 0,
HelpdeskHistoryI3D: null,
I3D: 7424,
LockedBy: null,
LockedByWorkstation: null,
LockedFilePath: null,
MetaInformations: null,
Name: 'yeshälloümööf',
ParentDirectoryI3D: 2093,
PublicDelete: false,
ThumbnailI3D: null,
UploadedByContactI3D: null,
Version: 1
}
]
@@ -0,0 +1,156 @@
[
{
Attachment: 0,
ChangedBy: {
Availability: 0,
BranchI3D: 0,
DefaultStorageI3D: null,
Dispatcher: false,
DisplayText: 'c-entron Administrator',
Email: null,
Employeenumber: null,
FirstName: 'c-entron',
FullName: 'Administrator, c-entron (ADMIN)',
I3D: 22,
IsActive: false,
LastAvailabilityChange: null,
LastName: 'Administrator',
LeavingDate: null,
Phone1: null,
RemainingDaysOfVacation: 0.0,
ShortSign: 'ADMIN',
State: null,
SupportLevel: null,
Template1: false,
Template2: false,
Template3: false,
Template4: false,
VacationEntitlement: 0.0
},
ChangedDate: DateTime,
CreatedBy: {
Availability: 0,
BranchI3D: 0,
DefaultStorageI3D: null,
Dispatcher: false,
DisplayText: 'c-entron Administrator',
Email: null,
Employeenumber: null,
FirstName: 'c-entron',
FullName: 'Administrator, c-entron (ADMIN)',
I3D: 22,
IsActive: false,
LastAvailabilityChange: null,
LastName: 'Administrator',
LeavingDate: null,
Phone1: null,
RemainingDaysOfVacation: 0.0,
ShortSign: 'ADMIN',
State: null,
SupportLevel: null,
Template1: false,
Template2: false,
Template3: false,
Template4: false,
VacationEntitlement: 0.0
},
CreatedDate: DateTime,
DMSSyncDate: null,
DMSSyncEmployeeI3D: null,
DMSSyncType: null,
DMSSyncUniqueID: null,
DocumentReferenceObjectKind: 2,
DocumentSize: 14,
FileData: null,
Flags: 0,
HelpdeskHistoryI3D: null,
I3D: 7425,
LockedBy: null,
LockedByWorkstation: null,
LockedFilePath: null,
MetaInformations: null,
Name: 'ibims2bildchen',
ParentDirectoryI3D: 2093,
PublicDelete: false,
ThumbnailI3D: null,
UploadedByContactI3D: null,
Version: 1
},
{
Attachment: 0,
ChangedBy: {
Availability: 0,
BranchI3D: 0,
DefaultStorageI3D: null,
Dispatcher: false,
DisplayText: 'c-entron Administrator',
Email: null,
Employeenumber: null,
FirstName: 'c-entron',
FullName: 'Administrator, c-entron (ADMIN)',
I3D: 22,
IsActive: false,
LastAvailabilityChange: null,
LastName: 'Administrator',
LeavingDate: null,
Phone1: null,
RemainingDaysOfVacation: 0.0,
ShortSign: 'ADMIN',
State: null,
SupportLevel: null,
Template1: false,
Template2: false,
Template3: false,
Template4: false,
VacationEntitlement: 0.0
},
ChangedDate: DateTime,
CreatedBy: {
Availability: 0,
BranchI3D: 0,
DefaultStorageI3D: null,
Dispatcher: false,
DisplayText: 'c-entron Administrator',
Email: null,
Employeenumber: null,
FirstName: 'c-entron',
FullName: 'Administrator, c-entron (ADMIN)',
I3D: 22,
IsActive: false,
LastAvailabilityChange: null,
LastName: 'Administrator',
LeavingDate: null,
Phone1: null,
RemainingDaysOfVacation: 0.0,
ShortSign: 'ADMIN',
State: null,
SupportLevel: null,
Template1: false,
Template2: false,
Template3: false,
Template4: false,
VacationEntitlement: 0.0
},
CreatedDate: DateTime,
DMSSyncDate: null,
DMSSyncEmployeeI3D: null,
DMSSyncType: null,
DMSSyncUniqueID: null,
DocumentReferenceObjectKind: 0,
DocumentSize: 14,
FileData: null,
Flags: 0,
HelpdeskHistoryI3D: null,
I3D: 7424,
LockedBy: null,
LockedByWorkstation: null,
LockedFilePath: null,
MetaInformations: null,
Name: 'yeshälloümööf',
ParentDirectoryI3D: 2093,
PublicDelete: false,
ThumbnailI3D: null,
UploadedByContactI3D: null,
Version: 1
}
]
@@ -0,0 +1,288 @@
using Centron.BusinessLogic;
using Centron.BusinessLogic.WebServices.Administration.FileManagement;
using Centron.Data.WebServices.Administration.FileManagement;
using Centron.Interfaces;
using Centron.Interfaces.Administration.Documents;
using Centron.Tests.EndToEnd.Infrastructure;
using System.Collections.Generic;
using System.Linq;
using Xunit;
using Xunit.Abstractions;
using Centron.Core.Extensions;
namespace Centron.Tests.EndToEnd.Tests.Documents
{
public class DocumentsTests : EndToEndTest
{
private int _referenceDirectoryI3D => 2093;
private int _referenceReceiptI3D => 242;
private int _referenceDocumentI3D;
private int _referenceDocument2I3D;
public DocumentsTests(ITestOutputHelper testOutputHelper)
: base(testOutputHelper)
{
// need to be ignored so we don't get an actual version from the assembly which is always different
this.Verifier.Settings.IgnoreProperty<DocumentDTO>(f => f.ChangedVersion);
this.Verifier.Settings.IgnoreProperty<DocumentDTO>(f => f.CreatedVersion);
}
public override void Execute()
{
// there are no documents in the testDB at all, so we first have to create them
// so we have to be careful with our order of operations: create->work with it->delete
this.AddDocumentToDirectory();
this.AddDocumentWithInvalidName();
this.AddDocumentToSpecialDirectory();
this.GetDocumentsByDirectory(1);
this.GetDocumentMetaInformations();
this.GetDocument();
this.UpdateFlags();
this.RenameDocument();
this.NewDocumentVersion();
this.CheckOutDocument();
this.CheckInDocument();
this.UndoCheckOutDocument();
this.DeleteDocument();
// rerun documentsbydirectory to ensure that we have the correct documents after everything we did
this.GetDocumentsByDirectory(2);
}
private void 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);
this._referenceDocumentI3D = result.I3D;
}
}
private void AddDocumentWithInvalidName()
{
// this is specifically to test handling of Centron.Core.StringExtensions.ConvertToAscii()
var asciiConvertedStrings = new List<string>()
{
"üöua",
"?.!bkalsdfjÄÖÜ",
"japaneseこんにちはsentence" // this is wild
}.Select(f => f.ConvertToAscii()).ToList();
this.Verifier.Verify("AsciiConvertedStrings", asciiConvertedStrings);
int documentI3D;
using (var session = new BLSession())
{
documentI3D = session.GetBL<DocumentWebServiceBL>().AddDocumentToDirectory(this.GetLoggedInUser(),
this._referenceDirectoryI3D,
new byte[]
{
1,2,3,4,5,6,7,8,10,11,12,13,14,15
},
"yeshälloümööf").I3D;
}
using (var session = new BLSession())
{
var resultDocument = session.GetBL<DocumentWebServiceBL>().GetDocument(this.GetLoggedInUser(), documentI3D).Data;
this.Verifier.Verify("DocumentWithAdjustedName", resultDocument);
}
}
private void AddDocumentToSpecialDirectory()
{
using (var session = new BLSession())
{
// this writes the document into the same directory as the AddDocumentToDirectory() does, just via a different method
var result = session.GetBL<DocumentWebServiceBL>().AddDocumentToSpecialDirectory(this.GetLoggedInUser(),
"ibims2bildchen",
new byte[]
{
1,2,3,4,5,6,7,8,10,11,12,13,14,15
},
this._referenceReceiptI3D,
CentronObjectKindNumeric.OrderClass,
new List<DocumentMetaInformationDTO>
{
new DocumentMetaInformationDTO
{
Type = DocumentMetaInformationType.ReceiptNumber,
TypeName = "ibims2receiptnumber",
Value = "456"
},
new DocumentMetaInformationDTO
{
Type = DocumentMetaInformationType.SupplierI3D,
TypeName = "ibims2supplieri3d",
Value = "456"
}
});
this._referenceDocument2I3D = result.I3D;
}
}
private void GetDocumentsByDirectory(int version)
{
using (var session = new BLSession())
{
var documents = session.GetBL<DocumentWebServiceBL>().GetDocumentsFromDirectory(this.GetLoggedInUser(), this._referenceDirectoryI3D);
this.Verifier.Verify("DocumentsFromDirectory" + version, documents);
}
using (var session = new BLSession())
{
var documents = session.GetBL<DocumentWebServiceBL>().GetDocumentsByDirectory(this._referenceDirectoryI3D);
this.Verifier.Verify("DocumentsByDirectory" + version, documents);
}
}
private void GetDocumentMetaInformations()
{
using (var session = new BLSession())
{
var metaInformations = session.GetBL<DocumentWebServiceBL>().GetDocumentMetaInformations(this.GetLoggedInUser(), new List<int>()
{
this._referenceDocumentI3D,
this._referenceDocument2I3D
});
this.Verifier.Verify("MetaInformations", metaInformations);
}
}
private void GetDocument()
{
var document = this.GetReferenceDocument();
this.Verifier.Verify("Document", document);
}
private void UpdateFlags()
{
using (var session = new BLSession())
{
session.GetBL<DocumentWebServiceBL>().UpdateDocumentFlags(this.GetLoggedInUser(), this._referenceDocumentI3D, DocumentFlags.IsPrinted | DocumentFlags.Checked);
}
var document = this.GetReferenceDocument();
this.Verifier.Verify("NewDocumentFlags", document.Flags);
}
private void RenameDocument()
{
using (var session = new BLSession())
{
session.GetBL<DocumentWebServiceBL>().RenameDocument(this.GetLoggedInUser(), this._referenceDocumentI3D, "ibims1document");
}
var document = this.GetReferenceDocument();
this.Verifier.Verify("NewDocumentName", document.Name);
}
private void NewDocumentVersion()
{
using (var session = new BLSession())
{
session.GetBL<DocumentWebServiceBL>().AddNewDocumentVersion(this._referenceDocumentI3D, new byte[]
{
1,2,3,4,5,6,7,8,10
}, this.GetLoggedInUser());
}
var document = this.GetReferenceDocument();
this.Verifier.Verify("NewDocumentVersion", document);
// we override this here as CheckInDocument creates a new version of the document, and we want to work with the newest version
this._referenceDocumentI3D = document.I3D;
}
private void CheckOutDocument()
{
using (var session = new BLSession())
{
session.GetBL<DocumentWebServiceBL>().CheckOutDocument(this._referenceDocumentI3D, "ibims1workstation", "ibims1dateipfad", this.GetLoggedInUser());
}
var document = this.GetReferenceDocument();
this.Verifier.Verify("DocumentCheckedOut", document);
}
private void CheckInDocument()
{
using (var session = new BLSession())
{
session.GetBL<DocumentWebServiceBL>().CheckInDocument(this._referenceDocumentI3D, new byte[20], this.GetLoggedInUser());
}
var document = this.GetReferenceDocument();
this.Verifier.Verify("DocumentCheckedIn", document);
// we override this here as CheckInDocument creates a new version of the document, and we want to work with the newest version
this._referenceDocumentI3D = document.I3D;
}
private void UndoCheckOutDocument()
{
using (var session = new BLSession())
{
session.GetBL<DocumentWebServiceBL>().CheckOutDocument(this._referenceDocumentI3D, "ibims1workstation", "ibims1dateipfad", this.GetLoggedInUser());
}
using (var session = new BLSession())
{
session.GetBL<DocumentWebServiceBL>().UndoCheckOut(this._referenceDocumentI3D);
}
var document = this.GetReferenceDocument();
this.Verifier.Verify("DocumentUndoCheckedOut", document);
}
private void DeleteDocument()
{
using (var session = new BLSession())
{
session.GetBL<DocumentWebServiceBL>().DeleteDocument(this.GetLoggedInUser(), this._referenceDocumentI3D);
}
var document = this.GetReferenceDocument();
Assert.Null(document);
}
private DocumentDTO GetReferenceDocument()
{
using (var session = new BLSession())
{
var document = session.GetBL<DocumentWebServiceBL>().GetNewestDocumentVersion(this.GetLoggedInUser(), this._referenceDocumentI3D);
return document.Data;
}
}
}
}
@@ -0,0 +1,10 @@
{
ContentLength: 219,
DocumentName: 'SignatureTemplate.docx',
HasCustomerPlaceholder: true,
HasEmployeePlaceholder: true,
HasRealCustomerData: false,
HasRealEmployeeData: false,
HasSignaturePlaceholder: true,
IsPotentialPrivacyViolation: false
}
@@ -0,0 +1,6 @@
{
HasEmployeePlaceholder: true,
HasPlaceholders: true,
HasSignaturePlaceholder: true,
OriginalContentLength: 219
}
@@ -0,0 +1,36 @@
{
Data: [
{
DocumentI3D: 7423,
I3D: 1,
Type: 3,
TypeName: 'ibims1receiptnumber',
Value: '123'
},
{
DocumentI3D: 7423,
I3D: 2,
Type: 1,
TypeName: 'ibims1supplieri3d',
Value: '123'
},
{
DocumentI3D: 7425,
I3D: 3,
Type: 3,
TypeName: 'ibims2receiptnumber',
Value: '456'
},
{
DocumentI3D: 7425,
I3D: 4,
Type: 1,
TypeName: 'ibims2supplieri3d',
Value: '456'
}
],
Error: null,
Message: null,
MessageCode: null,
Status: 0
}
@@ -0,0 +1,77 @@
{
Attachment: 0,
ChangedBy: {
Availability: 0,
BranchI3D: 0,
DefaultStorageI3D: null,
Dispatcher: false,
DisplayText: 'c-entron Administrator',
Email: null,
Employeenumber: null,
FirstName: 'c-entron',
FullName: 'Administrator, c-entron (ADMIN)',
I3D: 22,
IsActive: false,
LastAvailabilityChange: null,
LastName: 'Administrator',
LeavingDate: null,
Phone1: null,
RemainingDaysOfVacation: 0.0,
ShortSign: 'ADMIN',
State: null,
SupportLevel: null,
Template1: false,
Template2: false,
Template3: false,
Template4: false,
VacationEntitlement: 0.0
},
ChangedDate: DateTime,
CreatedBy: {
Availability: 0,
BranchI3D: 0,
DefaultStorageI3D: null,
Dispatcher: false,
DisplayText: 'c-entron Administrator',
Email: null,
Employeenumber: null,
FirstName: 'c-entron',
FullName: 'Administrator, c-entron (ADMIN)',
I3D: 22,
IsActive: false,
LastAvailabilityChange: null,
LastName: 'Administrator',
LeavingDate: null,
Phone1: null,
RemainingDaysOfVacation: 0.0,
ShortSign: 'ADMIN',
State: null,
SupportLevel: null,
Template1: false,
Template2: false,
Template3: false,
Template4: false,
VacationEntitlement: 0.0
},
CreatedDate: DateTime,
DMSSyncDate: null,
DMSSyncEmployeeI3D: null,
DMSSyncType: null,
DMSSyncUniqueID: null,
DocumentReferenceObjectKind: 0,
DocumentSize: 9,
FileData: 'AQIDBAUGBwgK',
Flags: 0,
HelpdeskHistoryI3D: null,
I3D: 7426,
LockedBy: null,
LockedByWorkstation: null,
LockedFilePath: null,
MetaInformations: null,
Name: 'ibims1document',
ParentDirectoryI3D: 2093,
PublicDelete: false,
ThumbnailI3D: null,
UploadedByContactI3D: null,
Version: 2
}
@@ -0,0 +1,7 @@
{
ContentLength: 219,
DocumentName: 'SignatureTemplate.docx',
HasCustomerPlaceholder: true,
HasEmployeePlaceholder: true,
HasSignaturePlaceholder: true
}
@@ -0,0 +1,7 @@
{
ContainsRealData: false,
HasEmployeePlaceholder: true,
HasPlaceholders: true,
HasSignaturePlaceholder: true,
ProcessedContentLength: 219
}
@@ -0,0 +1,247 @@
using Centron.BusinessLogic;
using Centron.BusinessLogic.WebServices.Administration.FileManagement;
using Centron.Data.Entities.Administration.FileManagement;
using Centron.Data.WebServices.Administration.FileManagement;
using Centron.Interfaces;
using Centron.Interfaces.Administration.Documents;
using Centron.Tests.EndToEnd.Infrastructure;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xunit.Abstractions;
namespace Centron.Tests.EndToEnd.Tests.Documents
{
/// <summary>
/// Tests for C-Sign signature template functionality to ensure templates are not permanently overwritten with customer data.
/// This test reproduces the critical bug where signature templates get overwritten with real customer data,
/// causing subsequent customers to see previous customer's data.
/// </summary>
public class SignatureTemplateTests : EndToEndTest
{
private int _testDirectoryI3D => 2093; // Using same directory as DocumentsTests
private int _signatureTemplateDocumentI3D;
private int _testReceiptCustomerA_I3D => 242; // First customer receipt
private int _testReceiptCustomerB_I3D => 243; // Second customer receipt (if exists)
public SignatureTemplateTests(ITestOutputHelper testOutputHelper)
: base(testOutputHelper)
{
// Ignore version properties that change with each test run
this.Verifier.Settings.IgnoreProperty<DocumentDTO>(f => f.ChangedVersion);
this.Verifier.Settings.IgnoreProperty<DocumentDTO>(f => f.CreatedVersion);
this.Verifier.Settings.IgnoreProperty<Document>(f => f.ChangedVersion);
this.Verifier.Settings.IgnoreProperty<Document>(f => f.CreatedVersion);
}
public override void Execute()
{
// Test the critical C-Sign template overwrite bug
this.CreateSignatureTemplate();
this.VerifyOriginalTemplateContent();
this.ProcessFirstCustomerSignature();
this.VerifyTemplateAfterFirstCustomer();
this.ProcessSecondCustomerSignature();
this.VerifyTemplateAfterSecondCustomer();
this.CleanupTestData();
}
/// <summary>
/// Creates a Word document template with signature placeholders
/// </summary>
private void CreateSignatureTemplate()
{
using (var session = new BLSession())
{
// Create a simple Word document with signature placeholders
var templateContent = CreateWordDocumentWithSignaturePlaceholders();
var result = session.GetBL<DocumentWebServiceBL>().AddDocumentToDirectory(
this.GetLoggedInUser(),
this._testDirectoryI3D,
templateContent,
"SignatureTemplate.docx",
new List<DocumentMetaInformationDTO>
{
new DocumentMetaInformationDTO
{
Type = DocumentMetaInformationType.Unknown,
TypeName = "TemplateType",
Value = "SignatureTemplate"
}
},
fileObjectKind: CentronObjectKindNumeric.Unknown);
this._signatureTemplateDocumentI3D = result.I3D;
}
}
/// <summary>
/// Verifies that the original template contains placeholders, not real data
/// </summary>
private void VerifyOriginalTemplateContent()
{
using (var session = new BLSession())
{
var document = session.GetBL<DocumentWebServiceBL>().GetDocument(this.GetLoggedInUser(), this._signatureTemplateDocumentI3D);
var contentAsString = Encoding.UTF8.GetString(document.Data.FileData);
// Verify template contains placeholders
this.Verifier.Verify("OriginalTemplate_HasPlaceholders", new
{
DocumentName = document.Data.Name,
HasSignaturePlaceholder = contentAsString.Contains("@@Unterschrift@@"),
HasEmployeePlaceholder = contentAsString.Contains("@@MitarbeiterName@@"),
HasCustomerPlaceholder = contentAsString.Contains("@@KundenName@@"),
ContentLength = document.Data.FileData.Length
});
}
}
/// <summary>
/// Simulates processing a signature for the first customer
/// This is where the bug occurs - the template gets overwritten
/// </summary>
private void ProcessFirstCustomerSignature()
{
using (var session = new BLSession())
{
// Get the template document via WebService BL (same as UI would do)
var templateDocument = session.GetBL<DocumentWebServiceBL>().GetDocument(this.GetLoggedInUser(), this._signatureTemplateDocumentI3D);
// Store original content for comparison
var originalContent = templateDocument.Data.FileData;
var originalContentAsString = Encoding.UTF8.GetString(originalContent);
this.Verifier.Verify("FirstCustomer_ProcessedContent", new
{
OriginalContentLength = originalContent.Length,
HasPlaceholders = originalContentAsString.Contains("@@"),
HasSignaturePlaceholder = originalContentAsString.Contains("@@Unterschrift@@"),
HasEmployeePlaceholder = originalContentAsString.Contains("@@MitarbeiterName@@")
});
}
}
/// <summary>
/// Verifies the template state after first customer processing
/// BUG: Template should still have placeholders, but it now has real customer data
/// </summary>
private void VerifyTemplateAfterFirstCustomer()
{
using (var session = new BLSession())
{
var document = session.GetBL<DocumentWebServiceBL>().GetDocument(this.GetLoggedInUser(), this._signatureTemplateDocumentI3D);
var contentAsString = Encoding.UTF8.GetString(document.Data.FileData);
// BUG DETECTION: Template should still have placeholders!
this.Verifier.Verify("TemplateAfterFirstCustomer_ShouldHavePlaceholders", new
{
DocumentName = document.Data.Name,
HasSignaturePlaceholder = contentAsString.Contains("@@Unterschrift@@"),
HasEmployeePlaceholder = contentAsString.Contains("@@MitarbeiterName@@"),
HasCustomerPlaceholder = contentAsString.Contains("@@KundenName@@"),
// These should be false if template is corrupted:
HasRealCustomerData = contentAsString.Contains("Customer A") || contentAsString.Contains("Kunde A"),
HasRealEmployeeData = contentAsString.Contains("Max Mustermann"),
ContentLength = document.Data.FileData.Length
});
}
}
/// <summary>
/// Simulates processing a signature for the second customer
/// This should use the original template, not the modified one from customer A
/// </summary>
private void ProcessSecondCustomerSignature()
{
using (var session = new BLSession())
{
// Get the template document again (should still be clean after first customer)
var templateDocument = session.GetBL<DocumentWebServiceBL>().GetDocument(this.GetLoggedInUser(), this._signatureTemplateDocumentI3D);
var contentAsString = Encoding.UTF8.GetString(templateDocument.Data.FileData);
this.Verifier.Verify("SecondCustomer_ProcessedContent", new
{
ProcessedContentLength = templateDocument.Data.FileData.Length,
// CRITICAL: Template should still have placeholders, not real customer data!
HasPlaceholders = contentAsString.Contains("@@"),
HasSignaturePlaceholder = contentAsString.Contains("@@Unterschrift@@"),
HasEmployeePlaceholder = contentAsString.Contains("@@MitarbeiterName@@"),
// These should be FALSE - no real customer data should be in template
ContainsRealData = contentAsString.Contains("Customer") && !contentAsString.Contains("@@")
});
}
}
/// <summary>
/// Final verification that template is still intact after both customers
/// BUG: Template will be permanently corrupted with customer data
/// </summary>
private void VerifyTemplateAfterSecondCustomer()
{
using (var session = new BLSession())
{
var document = session.GetBL<DocumentWebServiceBL>().GetDocument(this.GetLoggedInUser(), this._signatureTemplateDocumentI3D);
var contentAsString = Encoding.UTF8.GetString(document.Data.FileData);
// CRITICAL BUG VERIFICATION: Template should NEVER contain real customer data!
this.Verifier.Verify("FinalTemplate_ShouldBeClean", new
{
DocumentName = document.Data.Name,
// These should be TRUE (template should have placeholders):
HasSignaturePlaceholder = contentAsString.Contains("@@Unterschrift@@"),
HasEmployeePlaceholder = contentAsString.Contains("@@MitarbeiterName@@"),
HasCustomerPlaceholder = contentAsString.Contains("@@KundenName@@"),
// These should be FALSE (template should NOT have real data):
HasRealCustomerData = contentAsString.Contains("Customer A") || contentAsString.Contains("Kunde A"),
HasRealEmployeeData = contentAsString.Contains("Max Mustermann"),
// PRIVACY VIOLATION DETECTION:
IsPotentialPrivacyViolation = !contentAsString.Contains("@@") &&
(contentAsString.Contains("Customer") || contentAsString.Contains("Kunde")),
ContentLength = document.Data.FileData.Length
});
}
}
/// <summary>
/// Cleanup test data
/// </summary>
private void CleanupTestData()
{
using (var session = new BLSession())
{
session.GetBL<DocumentWebServiceBL>().DeleteDocument(this.GetLoggedInUser(), this._signatureTemplateDocumentI3D);
}
}
/// <summary>
/// Creates a simple Word document with signature placeholders for testing
/// </summary>
private byte[] CreateWordDocumentWithSignaturePlaceholders()
{
// Create a minimal Word document content with placeholders
var content = @"
Signature Template Document
Customer: @@KundenName@@
Employee: @@MitarbeiterName@@
Signature Box: @@Unterschrift@@
Date: @@UnterschriftDatum@@
";
// Normalize line endings to LF to ensure consistent byte length across environments
content = content.Replace("\r\n", "\n");
// For testing purposes, we'll use a simple text representation
// In a real scenario, this would be a proper Word document
return Encoding.UTF8.GetBytes(content);
}
}
}
@@ -0,0 +1,9 @@
{
ContentLength: 219,
DocumentName: 'SignatureTemplate.docx',
HasCustomerPlaceholder: true,
HasEmployeePlaceholder: true,
HasRealCustomerData: false,
HasRealEmployeeData: false,
HasSignaturePlaceholder: true
}