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

61 lines
2.1 KiB
C#

using System.Reflection;
using Centron.BusinessLogic.Administration.Licensing;
using Centron.Data.Entities.Administration.Logins;
using Centron.Interfaces.Administration.Logins;
using Centron.Interfaces.BL;
using Microsoft.Graph;
using Microsoft.Graph.Models;
using Microsoft.Kiota.Abstractions;
using Microsoft.Kiota.Abstractions.Serialization;
using NSubstitute;
namespace Centron.Tests.BL.SetupUtils;
public static class MockSetupUtils
{
public static ILicenseManager PrepareLicenseManagerMock(params Result<Guid>[] licenseGuids)
{
var mockedLicenseServer = Substitute.For<ILicenseManager>();
foreach (var license in licenseGuids)
{
mockedLicenseServer.CheckLicense(
Arg.Any<ApplicationKind>(),
Arg.Any<string>(),
Arg.Any<LoggedInUser>()).Returns(license);
mockedLicenseServer.HasLicense(
Arg.Is(license.Data)).Returns(license is { Status: ResultStatus.Success });
}
return mockedLicenseServer;
}
public static GraphServiceClient PrepareGraphMock(List<User> users)
{
return PrepareGraphMock<UserCollectionResponse>(users);
}
public static GraphServiceClient PrepareGraphMock<T>(object value) where T : IParsable, new()
{
var requestAdapter = Substitute.For<IRequestAdapter>();
var mock = new T();
var valueProperty = typeof(T).GetProperty("Value");
if (valueProperty == null)
throw new Exception("Value property not found");
if (!valueProperty.PropertyType.IsInstanceOfType(value))
throw new InvalidOperationException($"Value property type mismatch: expected {valueProperty.PropertyType}, got {value.GetType()}");
valueProperty.SetValue(mock, value);
requestAdapter.SendAsync(
Arg.Any<RequestInformation>(),
Arg.Any<ParsableFactory<T>>(),
Arg.Any<Dictionary<string, ParsableFactory<IParsable>>>(),
Arg.Any<CancellationToken>())
.ReturnsForAnyArgs(mock);
return new GraphServiceClient(requestAdapter);
}
}