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,184 @@
using System.Text;
using Centron.BusinessLogic.Administration.Settings;
using Centron.Common.TextCoding;
using Centron.Data.Entities.Accounts;
using Centron.Data.Entities.Administration;
using Centron.Data.Entities.Administration.Logins;
using Centron.Data.Entities.Administration.Settings;
using Centron.Data.Entities.CustomerArea;
using Centron.Data.Entities.EmployeeArea;
using Centron.DAO.TemporaryEntities;
using Centron.Interfaces.Administration.Settings;
using NHibernate;
namespace Centron.Tests.BL.SetupUtils;
public static class DbSetupUtils
{
public static AppUser SaveAppUser(
ISession session,
string? name,
string? email,
int id,
string? subjectId = null,
bool isAccountDisabled = false,
DateTime? commencementDate = null,
DateTime? leavingDate = null,
int state = 1,
string? plainTextPassword = null,
DateTime? disabledFromDate = null,
DateTime? disabledToDate = null,
bool isEmployeeActive = true)
{
var employee = new EmployeeCompact
{
I3D = id,
Email = email,
CommencementDate = commencementDate,
LeavingDate = leavingDate,
State = state,
IsActive = isEmployeeActive
};
string? encodedPassword = null;
if(plainTextPassword is not null)
{
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
encodedPassword = SHA1Decoder.GetDecodedSHA1String(plainTextPassword);
}
var appUser = new AppUser
{
Name = name,
I3D = id,
Employee = employee,
OpenIdConnectSubjectIdentifier = subjectId,
IsAccountDisabled = isAccountDisabled,
Password = encodedPassword,
AccountDisabledFromDate = disabledFromDate,
AccountDisabledToDate = disabledToDate
};
return SaveAppUser(session, appUser, employee, id);
}
public static AppUser SaveAppUser(ISession session, AppUser appUser, EmployeeCompact employee, int id)
{
session.Save(employee, id);
session.Save(appUser, id);
session.Flush();
return session.Get<AppUser>(id);
}
public static int SetupResponsibleEmployeeForWebaccounts(ISession session, EmployeeCompact responsibleEmployee)
{
// Get the AppUser associated with this employee
var appUser = session.Query<AppUser>()
.FirstOrDefault(u => u.Employee.I3D == responsibleEmployee.I3D);
if (appUser == null)
throw new InvalidOperationException($"No AppUser found for Employee I3D {responsibleEmployee.I3D}");
var id = (int)ApplicationSettingID.CentronSystemUser;
var setting = new ApplicationSetting
{
I3D = id,
ValueInt = appUser.I3D,
Description = "Centron System User for Webaccounts"
};
session.Save(setting);
session.Flush();
return appUser.I3D;
}
public static WebAccount SaveWebAccount(
ISession session,
string? name,
string? email,
int id,
string? plainTextPassword,
int status = 1)
{
var customer = new Customer
{
I3D = id,
};
// var address = new Address
// {
// I3D = id,
// CustomerI3D = customer.I3D,
// State = 1,
// };
// var contactPerson = new ContactPerson // Personen
// {
// I3D = id,
// Address = address,
// State = 1
// };
var account = new Account
{
I3D = id,
IsActive = true,
IsLocked = false
};
var accountAddress = new AccountAddress
{
I3D = id,
IsActive = true,
AccountI3D = account.I3D
};
var addressContact = new AccountAddressContact
{
I3D = id,
AccountAddressI3D = accountAddress.I3D,
IsActive = true
};
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
var encodedPassword = SHA1Decoder.GetDecodedSHA1String(plainTextPassword);
var webAccount = new WebAccount
{
I3D = id,
Username = name,
Status = status,
CustomerI3D = customer.I3D,
// AddressContactI3D = contactPerson.I3D,
AccountAddressContactI3D = addressContact.I3D,
Password = encodedPassword,
};
session.Save(customer, id);
// session.Save(address, id);
// session.Save(contactPerson, id);
session.Save(account, id);
session.Save(accountAddress, id);
session.Save(addressContact, id);
session.Save(webAccount, id);
session.Flush();
return session.Get<WebAccount>(id);
}
public static ApplicationSetting SaveApplicationSetting(
ISession session,
ApplicationSettingID id,
int? valueInt = null,
string? valueText = null,
decimal? valueDecimal = null,
string? description = null)
{
var setting = session.Get<ApplicationSetting>((int)id);
if (setting == null)
{
setting = new ApplicationSetting
{
I3D = (int)id
};
}
setting.ValueInt = valueInt;
setting.ValueText = valueText;
setting.ValueDecimal = valueDecimal;
setting.Description = description ?? "";
session.SaveOrUpdate(setting);
session.Flush();
return setting;
}
}
@@ -0,0 +1,61 @@
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);
}
}