Files
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

114 lines
3.6 KiB
C#

namespace Centron.Tests.BL.MyDay;
using Centron.DAO.Mappings.MyDay;
using Centron.Interfaces.BL;
using FluentNHibernate.Cfg;
using FluentNHibernate.Cfg.Db;
using NHibernate.Tool.hbm2ddl;
using System.Collections.Generic;
using Centron.BusinessLogic.MyDay;
using Centron.DAO;
using Centron.Data.Entities.MyDay;
using Centron.Data.WebServices.Tapi;
using Centron.Interfaces;
using JetBrains.Annotations;
using NHibernate;
using Xunit;
[TestSubject(typeof(MyDayBL))]
public class MyDayBLTest
{
[Fact]
public void GetEmployeeSelectionWorksAsExpected()
{
var session = CreateSession();
var myDayEmployeeSelection = new MyDayEmployeeSelection();
myDayEmployeeSelection.EmployeeI3D = 10;
myDayEmployeeSelection.AppUserI3D = 1;
myDayEmployeeSelection.DepartementI3D = 2;
var expectedResult =
Result<IList<MyDayEmployeeSelection>>.AsSuccess(new List<MyDayEmployeeSelection> { myDayEmployeeSelection });
session.Save(myDayEmployeeSelection);
session.Flush();
var daoSession = new DAOSession(session);
var myDayBL = new MyDayBL(daoSession);
var appUserI3D = 1;
var result = myDayBL.GetEmployeeSelection(appUserI3D);
Assert.Equivalent(expectedResult, result);
}
[Fact]
public void CreateGroupCallCaptionListsOtherParticipantsAndOrganizer()
{
var phoneCalls = new List<PhoneCallWithAccountDTO>
{
new()
{
CreatedBy = 1,
CreatorName = "Organizer",
CreatorNumber = "organizer@example.com",
OwnerKind = CentronObjectKindNumeric.EmployeeClass,
OwnerI3D = 2,
CallerName = "Anna",
CallerNumber = "anna@example.com"
},
new()
{
CreatedBy = 1,
CreatorName = "Organizer",
CreatorNumber = "organizer@example.com",
OwnerKind = CentronObjectKindNumeric.EmployeeClass,
OwnerI3D = 3,
CallerName = "Bob",
CallerNumber = "bob@example.com"
}
};
var caption = MyDayBL.CreateGroupCallCaption(phoneCalls, 2);
Assert.Equal("Microsoft Teams-Gruppengespräch mit Bob (bob@example.com), Organizer (organizer@example.com).", caption);
}
[Fact]
public void GetPhoneCallPeriodUsesFullGroupCallDuration()
{
var startTime = new DateTime(2026, 7, 30, 13, 23, 32);
var phoneCalls = new List<PhoneCallWithAccountDTO>
{
new()
{
StartTime = startTime.AddMinutes(2),
EndTime = startTime.AddSeconds(241)
},
new()
{
StartTime = startTime,
EndTime = startTime.AddSeconds(916)
}
};
var period = MyDayBL.GetPhoneCallPeriod(phoneCalls);
Assert.Equal(startTime, period.StartTime);
Assert.Equal(startTime.AddSeconds(916), period.EndTime);
}
public ISession CreateSession()
{
var fluentConfiguration = Fluently.Configure()
.Database(SQLiteConfiguration.Standard.InMemory)
.Mappings(m => m.FluentMappings.Add<MyDayEmployeeSelectionMaps>());
ISessionFactory sessionFactory = fluentConfiguration.BuildSessionFactory();
ISession session = sessionFactory.OpenSession();
new SchemaExport(fluentConfiguration.BuildConfiguration()).Execute(true, true, false, session.Connection, Console.Out);
return session;
}
}