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
61 lines
2.4 KiB
C#
61 lines
2.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Centron.BusinessLogic;
|
|
using Centron.BusinessLogic.Telemetry;
|
|
using Centron.Data.Entities.Telemetry;
|
|
using Centron.Tests.EndToEnd.Infrastructure;
|
|
using Xunit;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace Centron.Tests.EndToEnd.Tests.Telemetry
|
|
{
|
|
public class TelemetryUpsertApiCall_IncrementExisting : EndToEndTest
|
|
{
|
|
public TelemetryUpsertApiCall_IncrementExisting(ITestOutputHelper testOutputHelper) : base(testOutputHelper)
|
|
{
|
|
}
|
|
|
|
public override void Execute()
|
|
{
|
|
int methodI3D = 0;
|
|
this.WithSession(session =>
|
|
{
|
|
var resolve = session.GetBL<TelemetryBL>().ResolveApiMethodNameI3Ds(new[] { "GetSomething" });
|
|
Assert.True(resolve.IsSuccess);
|
|
methodI3D = resolve.Data["GetSomething"];
|
|
});
|
|
|
|
this.Sql($@"
|
|
INSERT INTO dbo.ApiCallTelemetry (UserID, UserKind, LicenseKind, MethodNameI3D, HardwareIDI3D, BucketStartUtc, [Count])
|
|
VALUES (11, 0, {(short)TelemetryLicenseKind.Centron}, {methodI3D}, 0, '2026-05-02T12:15:00', 6)");
|
|
|
|
var bucket = new DateTime(2026, 5, 2, 12, 15, 0, DateTimeKind.Utc);
|
|
var increments = new List<ApiCallBucketIncrement>
|
|
{
|
|
new()
|
|
{
|
|
UserID = 11,
|
|
UserKind = TelemetryUserKind.User,
|
|
LicenseKind = TelemetryLicenseKind.Centron,
|
|
MethodNameI3D = methodI3D,
|
|
BucketStartUtc = bucket,
|
|
Increment = 5
|
|
}
|
|
};
|
|
|
|
this.WithSession(session =>
|
|
{
|
|
var result = session.GetBL<TelemetryBL>().UpsertApiCallBatch(increments);
|
|
Assert.True(result.IsSuccess);
|
|
});
|
|
|
|
var rowCount = this.Sql<int>(
|
|
$"SELECT COUNT(*) FROM dbo.ApiCallTelemetry WHERE UserID = 11 AND UserKind = 0 AND LicenseKind = {(short)TelemetryLicenseKind.Centron} AND MethodNameI3D = {methodI3D} AND BucketStartUtc = '2026-05-02T12:15:00'");
|
|
var count = this.Sql<int>(
|
|
$"SELECT [Count] FROM dbo.ApiCallTelemetry WHERE UserID = 11 AND UserKind = 0 AND LicenseKind = {(short)TelemetryLicenseKind.Centron} AND MethodNameI3D = {methodI3D} AND BucketStartUtc = '2026-05-02T12:15:00'");
|
|
Assert.Equal(1, rowCount);
|
|
Assert.Equal(11, count);
|
|
}
|
|
}
|
|
}
|