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
129 lines
5.4 KiB
C#
129 lines
5.4 KiB
C#
using System;
|
|
using Centron.BusinessLogic;
|
|
using Centron.BusinessLogic.Accounts;
|
|
using Centron.Interfaces.Accounts;
|
|
using Centron.Interfaces.BL;
|
|
using Centron.Tests.EndToEnd.Infrastructure;
|
|
using CentronSoftware.Centron.WebServices.Entities.Accounts;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace Centron.Tests.EndToEnd.Tests.Account
|
|
{
|
|
public class AccountRelationshipTests : EndToEndTest
|
|
{
|
|
// Example Partners
|
|
private const int MicrosoftAccountI3D = 1036;
|
|
private const int MicrosoftAccountContactI3D = 1061;
|
|
private const int HPAccountI3D = 1034;
|
|
private const int HPAccountContactI3D = 1059;
|
|
|
|
// Example Accounts
|
|
private const int CentronAccountI3D = 1;
|
|
private const int CentronAccountContactI3D = 4;
|
|
private const int MuellerAccountI3D = 10;
|
|
private const int StadtvTuttlAccountI3D = 16;
|
|
private const int CelosSoftAccountI3D = 1028;
|
|
|
|
public AccountRelationshipTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper)
|
|
{
|
|
|
|
}
|
|
|
|
public override void Execute()
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
CreateRelationships(session);
|
|
UpdateRelationshipSettings(session);
|
|
ValidateRelationships(session, 1);
|
|
RemoveRelationship(session);
|
|
ValidateRelationships(session, 2);
|
|
CreateDublicateRelationship(session);
|
|
SearchSpecificRelationships(session);
|
|
}
|
|
}
|
|
|
|
private void CreateRelationships(BLSession session)
|
|
{
|
|
var bl = session.GetBL<AccountBL>();
|
|
// Add some accounts to Microsoft GmbH
|
|
bl.AddPartnerTooAccount(CentronAccountI3D, MicrosoftAccountI3D, MicrosoftAccountContactI3D);
|
|
bl.AddPartnerTooAccount(MuellerAccountI3D, MicrosoftAccountI3D, MicrosoftAccountContactI3D);
|
|
bl.AddPartnerTooAccount(StadtvTuttlAccountI3D, MicrosoftAccountI3D, MicrosoftAccountContactI3D);
|
|
bl.AddPartnerTooAccount(CelosSoftAccountI3D, MicrosoftAccountI3D, MicrosoftAccountContactI3D);
|
|
bl.AddPartnerTooAccount(HPAccountI3D, MicrosoftAccountI3D, MicrosoftAccountContactI3D);
|
|
|
|
// Add some accounts to Hewlett Packard
|
|
bl.AddPartnerTooAccount(MuellerAccountI3D, HPAccountI3D, HPAccountContactI3D);
|
|
bl.AddPartnerTooAccount(StadtvTuttlAccountI3D, HPAccountI3D, HPAccountContactI3D);
|
|
bl.AddPartnerTooAccount(CelosSoftAccountI3D, HPAccountI3D, HPAccountContactI3D);
|
|
|
|
bl.AddPartnerTooAccount(StadtvTuttlAccountI3D, CentronAccountI3D, CentronAccountContactI3D);
|
|
}
|
|
|
|
private void CreateDublicateRelationship(BLSession session)
|
|
{
|
|
var bl = session.GetBL<AccountBL>();
|
|
bl.AddPartnerTooAccount(CentronAccountI3D, MicrosoftAccountI3D, MicrosoftAccountContactI3D);
|
|
}
|
|
|
|
private void UpdateRelationshipSettings(BLSession session)
|
|
{
|
|
var bl = session.GetBL<AccountBL>();
|
|
|
|
var relationship = new AccountRelationshipDTO()
|
|
{
|
|
AccountI3D = StadtvTuttlAccountI3D,
|
|
PartnerAccountI3D = MicrosoftAccountI3D,
|
|
PartnerAccountContactI3D = MicrosoftAccountContactI3D,
|
|
NotifyAtCrmActivities = true,
|
|
NotifyAtOrders = true,
|
|
IsTelekomDivePartner = true
|
|
};
|
|
|
|
bl.UpdatePartnerInfo(relationship);
|
|
}
|
|
|
|
private void ValidateRelationships(BLSession session, int runCount)
|
|
{
|
|
var bl = session.GetBL<AccountBL>();
|
|
var result = bl.GetAccountRelationships(new AccountRelationshipFilter()
|
|
{
|
|
FilterKind = AccountRelationshipFilterKind.GetAllPartners
|
|
});
|
|
Verifier.Verify($"AccountRelationship_ValidateRelationships[{runCount}]_AllPartners", result);
|
|
|
|
result = bl.GetAccountRelationships(new AccountRelationshipFilter()
|
|
{
|
|
FilterKind = AccountRelationshipFilterKind.GetRelationshipsForAccount,
|
|
AccountI3D = MicrosoftAccountI3D
|
|
});
|
|
Verifier.Verify($"AccountRelationship_ValidateRelationships[{runCount}]_RelationshipsMicrosoftGmbHAccount", result);
|
|
|
|
result = bl.GetAccountRelationships(new AccountRelationshipFilter()
|
|
{
|
|
FilterKind = AccountRelationshipFilterKind.GetRelationshipsForAccount,
|
|
AccountI3D = CentronAccountI3D
|
|
});
|
|
Verifier.Verify($"AccountRelationship_ValidateRelationships[{runCount}]_RelationshipsCentronAccount", result);
|
|
}
|
|
|
|
private void SearchSpecificRelationships(BLSession session)
|
|
{
|
|
var bl = session.GetBL<AccountBL>();
|
|
var result = bl.GetAccountRelationships(new AccountRelationshipFilter()
|
|
{
|
|
FilterKind = AccountRelationshipFilterKind.GetRelationshipsForAccount,
|
|
AccountI3D = StadtvTuttlAccountI3D,
|
|
IsNotifyAtCrmActivitiesActive = true
|
|
});
|
|
Verifier.Verify("SearchSpecificRelationships", result);
|
|
}
|
|
|
|
private void RemoveRelationship(BLSession session)
|
|
{
|
|
var bl = session.GetBL<AccountBL>();
|
|
bl.RemovePartnerFromAccount(CelosSoftAccountI3D, MicrosoftAccountI3D, null);
|
|
}
|
|
}
|
|
} |