Files
Masterarbeit/QuellCode/CentronERP/tests/Centron.Tests.EndToEnd/Tests/UpdateAvailableNotificationSettings/UpdateAvailableNotificationSettingsTest.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
2.6 KiB
C#

using Centron.BusinessLogic;
using Centron.BusinessLogic.Administration.Settings;
using Centron.Interfaces.BL;
using Centron.Tests.EndToEnd.Infrastructure;
using CentronSoftware.Centron.WebServices.Entities.Administration.Updates;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
using Xunit.Abstractions;
namespace Centron.Tests.EndToEnd.Tests.UpdateAvailableNotificationSettings
{
public class UpdateAvailableNotificationSettingsTest : EndToEndTest
{
public UpdateAvailableNotificationSettingsTest(ITestOutputHelper testOutputHelper)
: base(testOutputHelper)
{
}
public override void Execute()
{
this.CanReadSettings("InitialState");
this.CanChangeSettings("AllEmployeesWithNullList", UpdateAvailableNotificationKind.ShowToAllEmployees, null);
this.CanChangeSettings("AdministratorsWithNewList", UpdateAvailableNotificationKind.ShowToAdministrators, new List<int>());
this.CanChangeSettings("SelectedEmployeesWithList", UpdateAvailableNotificationKind.ShowToSelectedEmployees, new List<int> { 1, 2, 3 });
this.ThrowsWhenNoEmployees(null);
this.ThrowsWhenNoEmployees(new List<int>());
}
private void CanReadSettings(string name)
{
using (var session = new BLSession())
{
var settings = session.GetBL<AppSettingsGroupBL>().GetUpdateAvailableNotificationSettings();
this.Verifier.Verify(name, settings);
}
}
private void CanChangeSettings(string name, UpdateAvailableNotificationKind kind, List<int> employeeI3Ds)
{
UpdateAvailableNotificationSettingsDTO settings;
using(var session = new BLSession())
{
settings = session.GetBL<AppSettingsGroupBL>().GetUpdateAvailableNotificationSettings();
}
settings.NotificationKind = kind;
settings.EmployeeI3Ds = employeeI3Ds;
using (var session = new BLSession())
{
session.GetBL<AppSettingsGroupBL>().UpdateUpdateAvailableNotificationSettings(settings);
}
this.CanReadSettings(name);
}
private void ThrowsWhenNoEmployees(List<int> employees)
{
var ex = Assert.Throws<ResultException>(() => this.CanChangeSettings("Throws", UpdateAvailableNotificationKind.ShowToSelectedEmployees, employees));
Assert.Equal(DefaultMessageCodes.BadRequest, ex.MessageCode);
}
}
}