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
63 lines
2.3 KiB
C#
63 lines
2.3 KiB
C#
using System.Collections.Generic;
|
|
using System.Data.SqlClient;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using Centron.BusinessLogic;
|
|
using Centron.BusinessLogic.Administration.FileManagement;
|
|
using Centron.BusinessLogic.WebServices.Administration.FileManagement;
|
|
using Centron.DAO.AdoNETDataAccess;
|
|
using Centron.Tests.EndToEnd.Infrastructure;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace Centron.Tests.EndToEnd.TicketTests.Ticket127512;
|
|
|
|
public class Ticket127512Tests : EndToEndTest
|
|
{
|
|
public Ticket127512Tests(ITestOutputHelper testOutputHelper)
|
|
: base(testOutputHelper)
|
|
{
|
|
}
|
|
|
|
private const int DirectoryI3D = 77; //Directory "Kunde 10001"
|
|
|
|
public override void Execute()
|
|
{
|
|
// DocumentBL
|
|
// .GetDocumentsByDirectory
|
|
// .GetDocumentsFromDirectory
|
|
//
|
|
// These methods had a little performance-problem, because they would always load the file-contents from the database
|
|
// even if they were not needed
|
|
|
|
this.PrepareDatabase();
|
|
|
|
var getDocumentsByDirectorySqlCommands = SqlDiagnosticObserver.Start(() =>
|
|
{
|
|
using var session = new BLSession();
|
|
session.GetBL<DocumentWebServiceBL>().GetDocumentsByDirectory(DirectoryI3D);
|
|
});
|
|
|
|
var loggedInUser = this.GetLoggedInUser();
|
|
var getDocumentsFromDirectorySqlCommands = SqlDiagnosticObserver.Start(() =>
|
|
{
|
|
using var session = new BLSession();
|
|
session.GetBL<DocumentWebServiceBL>().GetDocumentsFromDirectory(loggedInUser, DirectoryI3D);
|
|
});
|
|
|
|
this.Verifier.Verify("SqlCommands_GetDocumentsByDirectory", getDocumentsByDirectorySqlCommands.Select(f => f.CommandText));
|
|
this.Verifier.Verify("SqlCommands_GetDocumentsFromDirectory", getDocumentsFromDirectorySqlCommands.Select(f => f.CommandText));
|
|
}
|
|
|
|
private void PrepareDatabase()
|
|
{
|
|
for (int i = 0; i < 50; i++)
|
|
{
|
|
var testData = Encoding.UTF8.GetBytes("Testdata");
|
|
|
|
using var session = new BLSession();
|
|
session.GetBL<DocumentWebServiceBL>().AddDocumentToDirectory(this.GetLoggedInUser(), DirectoryI3D, testData, $"Test {i}.txt");
|
|
}
|
|
|
|
this.Verifier.VerifySql("DocumentsTable", $"SELECT DocCount = COUNT(*) FROM dbo.Documents WHERE OwnerDirI3D = {DirectoryI3D}");
|
|
}
|
|
} |