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
211 lines
8.7 KiB
C#
211 lines
8.7 KiB
C#
using Centron.BusinessLogic;
|
|
using Centron.BusinessLogic.WebServices.DataExchange.TelekomDive;
|
|
using Centron.Tests.EndToEnd.Infrastructure;
|
|
using CentronSoftware.Centron.WebServices.Entities.DataExchange.TelekomDive;
|
|
using Microsoft.AspNetCore.Mvc.RazorPages;
|
|
using NLog.Filters;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace Centron.Tests.EndToEnd.Tests.DataExchange.TelekomDive
|
|
{
|
|
public class TelekomDiveProfileTest : EndToEndTest
|
|
{
|
|
public TelekomDiveProfileTest(ITestOutputHelper testOutputHelper)
|
|
: base(testOutputHelper)
|
|
{
|
|
// Ignore date/version fields in snapshot verification as they change with each run
|
|
this.Verifier.Settings.IgnoreProperty<TelekomDiveProfileDTO>(f => f.CreatedDate);
|
|
this.Verifier.Settings.IgnoreProperty<TelekomDiveProfileDTO>(f => f.ChangedDate);
|
|
}
|
|
|
|
public override void Execute()
|
|
{
|
|
var savedProfiles = this.CreateAndSaveTwoProfiles();
|
|
this.LoadAndVerifyProfiles(savedProfiles);
|
|
this.FilterProfilesByMandator(savedProfiles);
|
|
this.FilterProfilesByVisibility(savedProfiles);
|
|
}
|
|
|
|
private List<TelekomDiveProfileDTO> CreateAndSaveTwoProfiles()
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
var user = this.GetLoggedInUser();
|
|
|
|
var profile1 = new TelekomDiveProfileDTO
|
|
{
|
|
ProfileName = "Test Profile 1 - Full Config",
|
|
MandatorI3D = 1,
|
|
OfferRecipient = "Customer A - Test Company GmbH",
|
|
BasedOnFrameContract = true,
|
|
FrameContractNumber = "FC-2025-001",
|
|
PartnerVatId = "DE123456789",
|
|
PartnerCreditorId = "CRED-A-001",
|
|
DiveComment = "This is a test profile with all features enabled",
|
|
UseFixedPaymentDeadline = true,
|
|
FixedPaymentDeadline = "30 days net",
|
|
ValidityPeriodInDays = 14,
|
|
UseFixedPosDiscount = true,
|
|
FixedPosDiscount = 10.50m,
|
|
UseFixedVAT = true,
|
|
FixedVAT = 19.00m,
|
|
IsVisible = true
|
|
};
|
|
|
|
var profile2 = new TelekomDiveProfileDTO
|
|
{
|
|
ProfileName = "Test Profile 2 - Minimal Config",
|
|
MandatorI3D = 2,
|
|
OfferRecipient = "Customer B - Another Test Company AG",
|
|
BasedOnFrameContract = false,
|
|
FrameContractNumber = null,
|
|
PartnerVatId = "DE987654321",
|
|
PartnerCreditorId = "CRED-B-002",
|
|
DiveComment = "Minimal configuration test profile",
|
|
UseFixedPaymentDeadline = false,
|
|
FixedPaymentDeadline = null,
|
|
ValidityPeriodInDays = 30,
|
|
UseFixedPosDiscount = false,
|
|
FixedPosDiscount = null,
|
|
UseFixedVAT = false,
|
|
FixedVAT = null,
|
|
IsVisible = false
|
|
};
|
|
|
|
var profilesToSave = new List<TelekomDiveProfileDTO> { profile1, profile2 };
|
|
|
|
var saveResult = session.GetBL<TelekomDiveWebServiceBL>()
|
|
.SaveTelekomDiveProfiles(profilesToSave, user);
|
|
|
|
if(saveResult.IsSuccess == false)
|
|
throw new Exception($"Failed to save profiles: {saveResult.MessageCode}");
|
|
|
|
this.Verifier.Verify("CreateAndSaveTwoProfiles", saveResult);
|
|
|
|
return saveResult.Data.ToList();
|
|
}
|
|
}
|
|
|
|
private void LoadAndVerifyProfiles(List<TelekomDiveProfileDTO> savedProfiles)
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
var filter = new TelekomDiveProfileFilter();
|
|
|
|
var loadResult = session.GetBL<TelekomDiveWebServiceBL>()
|
|
.GetTelekomDiveProfiles(filter);
|
|
|
|
if (loadResult.IsSuccess == false)
|
|
throw new Exception($"Failed to load profiles: {loadResult.MessageCode}");
|
|
|
|
this.Verifier.Verify("LoadAndVerifyProfiles", loadResult);
|
|
|
|
if (loadResult.Data.Count != savedProfiles.Count)
|
|
{
|
|
throw new Exception($"Expected {savedProfiles.Count} profiles, but found {loadResult.Data.Count}");
|
|
}
|
|
|
|
// Verify the saved profiles are in the loaded results
|
|
foreach (var savedProfile in savedProfiles)
|
|
{
|
|
var loadedProfile = loadResult.Data.FirstOrDefault(p => p.I3D == savedProfile.I3D);
|
|
if (loadedProfile == null)
|
|
{
|
|
throw new Exception($"Profile with I3D {savedProfile.I3D} was not found in loaded profiles");
|
|
}
|
|
|
|
if (string.Equals(loadedProfile.ProfileName, savedProfile.ProfileName) == false)
|
|
{
|
|
throw new Exception($"ProfileName mismatch for I3D {savedProfile.I3D}");
|
|
}
|
|
|
|
if (loadedProfile.MandatorI3D != savedProfile.MandatorI3D)
|
|
{
|
|
throw new Exception($"MandatorI3D mismatch for I3D {savedProfile.I3D}");
|
|
}
|
|
|
|
if (string.Equals(loadedProfile.OfferRecipient, savedProfile.OfferRecipient) == false)
|
|
{
|
|
throw new Exception($"OfferRecipient mismatch for I3D {savedProfile.I3D}");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private void FilterProfilesByMandator(List<TelekomDiveProfileDTO> savedProfiles)
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
var user = this.GetLoggedInUser();
|
|
var mandatorI3D = savedProfiles.First().MandatorI3D;
|
|
|
|
var filter = new TelekomDiveProfileFilter { MandatorI3D = mandatorI3D };
|
|
|
|
var filterResult = session.GetBL<TelekomDiveWebServiceBL>()
|
|
.GetTelekomDiveProfiles(filter);
|
|
|
|
if (filterResult.IsSuccess == false)
|
|
throw new Exception($"Failed to load profiles by mandator filter: {filterResult.MessageCode}");
|
|
|
|
|
|
this.Verifier.Verify("FilterProfilesByMandator", filterResult);
|
|
|
|
if (filterResult.Data.Any(p => p.MandatorI3D != mandatorI3D))
|
|
{
|
|
throw new Exception("Filter by MandatorI3D failed - found profiles with different MandatorI3D");
|
|
}
|
|
}
|
|
}
|
|
|
|
private void FilterProfilesByVisibility(List<TelekomDiveProfileDTO> savedProfiles)
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
var user = this.GetLoggedInUser();
|
|
|
|
var savedVisibleI3D = savedProfiles.First(p => p.IsVisible).I3D;
|
|
var savedInvisibleI3D = savedProfiles.First(p => !p.IsVisible).I3D;
|
|
|
|
var visibleFilter = new TelekomDiveProfileFilter { IsVisible = true };
|
|
|
|
var visibleResult = session.GetBL<TelekomDiveWebServiceBL>()
|
|
.GetTelekomDiveProfiles(visibleFilter);
|
|
|
|
if (visibleResult.IsSuccess == false)
|
|
throw new Exception($"Failed to load profiles by visible filter: {visibleResult.MessageCode}");
|
|
|
|
this.Verifier.Verify("FilterProfilesByVisibility_Visible", visibleResult);
|
|
|
|
// Verify invisible profile is not in results
|
|
if (visibleResult.Data.Any(p => p.I3D == savedInvisibleI3D))
|
|
{
|
|
throw new Exception("Filter by IsVisible=true failed - found invisible profile");
|
|
}
|
|
|
|
// Filter for invisible profiles only
|
|
var invisibleFilter = new TelekomDiveProfileFilter
|
|
{
|
|
IsVisible = false
|
|
};
|
|
|
|
var invisibleResult = session.GetBL<TelekomDiveWebServiceBL>()
|
|
.GetTelekomDiveProfiles(invisibleFilter);
|
|
|
|
if (invisibleResult.IsSuccess == false)
|
|
throw new Exception($"Failed to load profiles by invisible filter: {invisibleResult.MessageCode}");
|
|
|
|
this.Verifier.Verify("FilterProfilesByVisibility_Invisible", invisibleResult);
|
|
|
|
// Verify visible profile is not in results
|
|
if (invisibleResult.Data.Any(p => p.I3D == savedVisibleI3D))
|
|
{
|
|
throw new Exception("Filter by IsVisible=false failed - found visible profile");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|