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
65 lines
2.0 KiB
C#
65 lines
2.0 KiB
C#
using System;
|
|
using System.IO;
|
|
using Centron.BusinessLogic.WebServices.Administration.FileManagement;
|
|
using Centron.Interfaces.BL;
|
|
using Centron.Tests.EndToEnd.Infrastructure;
|
|
using Xunit;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace Centron.Tests.EndToEnd.Tests.MailDocuments;
|
|
|
|
public class MailDocumentTests : EndToEndTest
|
|
{
|
|
public MailDocumentTests(ITestOutputHelper testOutputHelper)
|
|
: base(testOutputHelper)
|
|
{
|
|
}
|
|
|
|
public const int DirectoryI3D = 61;
|
|
|
|
[SkipOnLinuxFact]
|
|
public override void Execute()
|
|
{
|
|
RunTest("msg");
|
|
RunTest("eml");
|
|
}
|
|
|
|
private void RunTest(string format)
|
|
{
|
|
var documentI3D = this.CreateTestMailDocument(format);
|
|
|
|
var emailResult = this.WithSession(s => s.GetBL<DocumentWebServiceBL>().GetMailDocument(this.GetLoggedInUser(), documentI3D));
|
|
Assert.Equal(ResultStatus.Success, emailResult.Status);
|
|
var email = emailResult.Data;
|
|
this.Verifier.Verify($"Email-{format}", email);
|
|
|
|
var attachment = this.WithSession(s => s.GetBL<DocumentWebServiceBL>().GetMailDocumentAttachment(documentI3D, email.Attachments[0].FileName));
|
|
Assert.NotNull(attachment);
|
|
Assert.NotEmpty(attachment);
|
|
Assert.Equal(email.Attachments[0].FileSize, attachment.Length);
|
|
}
|
|
|
|
private int CreateTestMailDocument(string format)
|
|
{
|
|
var testFileName = $"Mail.{format}";
|
|
var testFileData = this.GetTestEmail(format);
|
|
|
|
var document = this.WithSession(s => s.GetBL<DocumentWebServiceBL>().AddDocumentToDirectory(
|
|
this.GetLoggedInUser(),
|
|
DirectoryI3D,
|
|
testFileData,
|
|
testFileName));
|
|
|
|
return document.I3D;
|
|
}
|
|
|
|
private byte[] GetTestEmail(string format)
|
|
{
|
|
using var stream = this.GetType().Assembly.GetManifestResourceStream(this.GetType(), $"Test-Mail.{format}");
|
|
using var memoryStream = new MemoryStream();
|
|
|
|
stream.CopyTo(memoryStream);
|
|
|
|
return memoryStream.ToArray();
|
|
}
|
|
} |