Files
Masterarbeit/QuellCode/CentronERP/tests/Centron.Tests.EndToEnd/Tests/Contracts/ContractTests.cs
T
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

70 lines
3.0 KiB
C#

using System;
using System.Diagnostics.Contracts;
using Centron.BusinessLogic;
using Centron.BusinessLogic.EmployeeArea;
using Centron.BusinessLogic.Sales.Receipts.ContractLists;
using Centron.BusinessLogic.Sales.Receipts.DataAndResults;
using Centron.BusinessLogic.WebServices.Sales.Receipts;
using Centron.Data.Entities.Administration.Logins;
using Centron.Data.WebServices.Sales.CustomerAssets.Contracts;
using Centron.Interfaces;
using Centron.Interfaces.Administration.Environment;
using Centron.Interfaces.BL;
using Centron.Interfaces.Sales.BillingCenter.Contracts;
using Centron.Tests.EndToEnd.Infrastructure;
using CentronSoftware.Centron.WebServices.Entities.Sales.Receipts.ContractLists;
using Newtonsoft.Json;
using Xunit;
using Xunit.Abstractions;
namespace Centron.Tests.EndToEnd.Tests.Contracts
{
public class ContractTests : EndToEndTest
{
public ContractTests(ITestOutputHelper testOutputHelper)
: base(testOutputHelper)
{
}
public override void Execute()
{
var contract = this.GetNewContract();
this.SaveNewContract(contract);
}
private ReceiptContractDTO GetNewContract()
{
using (var session = new BLSession())
{
var user = session.GetBL<AppUserBL>().GetAppUser(f => f.I3D == 11);
var result = session.GetBL<ReceiptWebServiceBL>().CreateNewReceipt(CentronObjectKindNumeric.ContractClass, new LoggedInUser(user), 10022, new CreateReceiptData(), null, null, true, false, true);
var contract = (ReceiptContractDTO)result.Data.Receipt;
contract.BillingIntervalDuration = 0;
contract.CounterBillingKind = 0;
contract.CalcNeedKind = 0;
contract.BillingKind = 0;
contract.ContractKindI3D = 12;
//we need these 2 so todo gets created
contract.FirstPaidDate = new DateTime(2020, 1, 1);
contract.CalculationKind = ContractCalculationKind.Auto;
//before this would create a null ref
contract.ContractBillingToDoOffset = null;
return contract;
}
}
private void SaveNewContract(ReceiptContractDTO receipt)
{
using (var session = new BLSession())
{
var user = session.GetBL<AppUserBL>().GetAppUser(f => f.I3D == 11);
var result = session.GetBL<ReceiptWebServiceBL>().SaveReceipt(receipt, user, new SaveReceiptData
{
IgnoreCallbacks = true
}, false, CreatedThroughApplication.CentronNet, null);
Assert.Equal(ResultStatus.Success, result.Status);
this.Verifier.VerifySql("ContractTodoExists", $"SELECT Termin, Bereich, ObjektArt, ObjectI3D FROM ToDoListe WHERE ObjektArt = 22 AND ObjectI3D = {result.Data.Receipt.I3D}");
}
}
}
}