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
247 lines
8.8 KiB
C#
247 lines
8.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Xunit.Abstractions;
|
|
using Centron.Tests.EndToEnd.Infrastructure;
|
|
using Centron.BusinessLogic;
|
|
using Centron.BusinessLogic.MyDay;
|
|
using Centron.Data.WebServices.Sales.Support;
|
|
using Centron.BusinessLogic.WebServices.Sales.Support;
|
|
using Centron.Data.Entities.Administration.Logins;
|
|
using Centron.BusinessLogic.EmployeeArea;
|
|
using Centron.BusinessLogic.WebServices.Administration.MasterData;
|
|
using Centron.Interfaces.MyDay;
|
|
using Centron.Data.Entities.Tapi;
|
|
using Centron.BusinessLogic.Tapi;
|
|
using Centron.BusinessLogic.WebServices.MyCentron;
|
|
using CentronSoftware.Centron.WebServices.Entities.MyDay;
|
|
using Centron.Data.Entities.MyCentron;
|
|
using Centron.Interfaces;
|
|
using Centron.Interfaces.BL;
|
|
using Centron.Core.Extensions;
|
|
|
|
namespace Centron.Tests.EndToEnd.Tests.MyDay
|
|
{
|
|
public class MyDayTests : EndToEndTest
|
|
{
|
|
private LoggedInUser GetUser(BLSession session) => new LoggedInUser(session.GetBL<AppUserBL>().GetAppUser(f => f.I3D == 11));
|
|
private LoggedInUser GetUser()
|
|
{
|
|
using (var session = new BLSession())
|
|
return new LoggedInUser(session.GetBL<AppUserBL>().GetAppUser(f => f.I3D == 11));
|
|
}
|
|
|
|
private readonly int _referenceCustomerI3D = 10000;
|
|
|
|
private DateTime _baseDate => new DateTime(2020, 1, 1);
|
|
|
|
public MyDayTests(ITestOutputHelper testOutputHelper)
|
|
: base(testOutputHelper)
|
|
{
|
|
this.Verifier.Settings.IgnoreProperty<HelpdeskTimerDTO>(f => f.CreatedVersion);
|
|
}
|
|
|
|
public override void Execute()
|
|
{
|
|
return;
|
|
|
|
// this.PrepareDatabase();
|
|
//
|
|
// this.GetSettings();
|
|
// this.UpdateSettings();
|
|
//
|
|
// this.GetNewWorkItems();
|
|
// this.SaveTimeLine();
|
|
// this.GetWorkItems();
|
|
// this.GetWorkItemByI3D();
|
|
}
|
|
|
|
private void PrepareDatabase()
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
var user = this.GetUser(session);
|
|
var employee = session.GetBL<EmployeeWebserviceBL>().GetEmployeePreviews(new List<int>
|
|
{
|
|
user.User.Employee.I3D
|
|
}).ThrowIfError().First();
|
|
|
|
var helpdeskI3D = 10491;
|
|
|
|
session.GetBL<HelpdeskTimerWebServiceBL>().SaveHelpdeskTimer(new HelpdeskTimerDTO
|
|
{
|
|
Start = this._baseDate.AddHours(8),
|
|
Stop = this._baseDate.AddHours(9),
|
|
Employee = employee,
|
|
InternalNote = "Internal note 1",
|
|
ExternalNote = "External note 1",
|
|
HelpdeskI3D = helpdeskI3D
|
|
}, user);
|
|
|
|
session.GetBL<HelpdeskTimerWebServiceBL>().SaveHelpdeskTimer(new HelpdeskTimerDTO
|
|
{
|
|
Start = this._baseDate.AddHours(13),
|
|
Stop = this._baseDate.AddHours(15),
|
|
Employee = employee,
|
|
InternalNote = "Internal note 2",
|
|
ExternalNote = "External note 2",
|
|
HelpdeskI3D = helpdeskI3D,
|
|
Calculable = true
|
|
}, user);
|
|
|
|
session.GetBL<PhoneCallBL>().SaveOrUpdateCall(new PhoneCall
|
|
{
|
|
StartTime = this._baseDate.AddHours(9),
|
|
EndTime = this._baseDate.AddHours(10.5),
|
|
CallerNumber = "1234",
|
|
CallerName = "CallerName",
|
|
WasConnected = true,
|
|
|
|
OwnerI3D = 72,
|
|
OwnerKind = CentronObjectKindNumeric.ContactPerson
|
|
}, user.User);
|
|
|
|
session.GetBL<LatestUsedCentronObjectWebServiceBL>().AddComplete(user.User,
|
|
LatestUsedCentronObjectKind.Customer,
|
|
CentronObjectKindNumeric.Account,
|
|
this._referenceCustomerI3D,
|
|
"Worked on customer " + this._referenceCustomerI3D,
|
|
this._baseDate.AddHours(14),
|
|
this._baseDate.AddHours(16));
|
|
}
|
|
}
|
|
|
|
private void GetSettings()
|
|
{
|
|
var settings = this.GetSettingsInternal();
|
|
this.Verifier.Verify("Settings", settings);
|
|
}
|
|
|
|
private void UpdateSettings()
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
var settings = this.GetSettingsInternal();
|
|
|
|
settings.EditPeriod = 20;
|
|
|
|
settings.WorkTimeStart = TimeSpan.FromHours(15);
|
|
settings.WorkTimeEnd = TimeSpan.FromHours(18);
|
|
settings.BreakDuration = TimeSpan.FromHours(1.5);
|
|
|
|
settings.SpecialTimeSettings = new List<MyDaySpecialTimeSettingDTO>
|
|
{
|
|
new MyDaySpecialTimeSettingDTO
|
|
{
|
|
BreakDuration = TimeSpan.FromHours(1),
|
|
WorkTimeStart = TimeSpan.FromHours(7),
|
|
WorkTimeEnd = TimeSpan.FromHours(20),
|
|
Employees = new List<MyDaySpecialTimeSettingAssignmentDTO>
|
|
{
|
|
new MyDaySpecialTimeSettingAssignmentDTO
|
|
{
|
|
EmployeeI3D = this.GetUser(session).User.Employee.I3D
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
settings.SendDayNotFinalizedNotifications = true;
|
|
|
|
settings.DayNotFinalizedNotificationSendTime = TimeSpan.FromHours(20);
|
|
|
|
session.GetBL<MyDayWebServiceBL>().UpdateSettings(settings).ThrowIfError();
|
|
|
|
var updatedSettings = this.GetSettingsInternal();
|
|
|
|
this.Verifier.Verify("UpdatedSettings", updatedSettings);
|
|
}
|
|
}
|
|
|
|
private MyDaySettingsDTO GetSettingsInternal()
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
return session.GetBL<MyDayWebServiceBL>().GetSettings().ThrowIfError();
|
|
}
|
|
}
|
|
|
|
private void GetNewWorkItems()
|
|
{
|
|
var newWorkItems = this.GetNewWorkItemsInternal();
|
|
|
|
this.Verifier.Verify("NewWorkItems", newWorkItems);
|
|
}
|
|
|
|
private void SaveTimeLine()
|
|
{
|
|
var workItems = this.GetNewWorkItemsInternal();
|
|
|
|
workItems.Add(new MyDayWorkItemDTO
|
|
{
|
|
BreakTime = TimeSpan.FromHours(1),
|
|
StartTime = this._baseDate.AddHours(20),
|
|
EndTime = this._baseDate.AddHours(22),
|
|
Caption = "I am a caption",
|
|
EmployeeI3D = this.GetUser().User.Employee.I3D,
|
|
Type = MyDayWorkItemType.Other,
|
|
ShowInTimeLine = true
|
|
});
|
|
|
|
foreach (var currentWorkItem in workItems)
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
session.GetBL<MyDayWebServiceBL>().SaveOrUpdateWorkItem(currentWorkItem).ThrowIfError();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void GetWorkItems()
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
var workItems = session.GetBL<MyDayWebServiceBL>().GetWorkItems(new MyDayWorkItemsFilter
|
|
{
|
|
EmployeeI3Ds = new List<int>
|
|
{
|
|
this.GetUser(session).User.Employee.I3D
|
|
},
|
|
StarTime = this._baseDate.StartOfDay(),
|
|
EndTime = this._baseDate.EndOfDay(),
|
|
IncludeItemsNotShownInTimeLine = true
|
|
}, this.GetUser(session)).ThrowIfError();
|
|
|
|
this.Verifier.Verify("WorkItems", workItems.OrderBy(o => o.I3D));
|
|
}
|
|
}
|
|
|
|
private IList<MyDayWorkItemDTO> GetNewWorkItemsInternal()
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
return session
|
|
.GetBL<MyDayWebServiceBL>()
|
|
.GetNewWorkItems(new MyDayWorkItemsFilter
|
|
{
|
|
EmployeeI3Ds = new List<int>
|
|
{
|
|
this.GetUser(session).User.Employee.I3D
|
|
},
|
|
StarTime = this._baseDate.StartOfDay(),
|
|
EndTime = this._baseDate.EndOfDay()
|
|
}, this.GetUser(session)).ThrowIfError();
|
|
}
|
|
}
|
|
|
|
private void GetWorkItemByI3D()
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
var workItem = session.GetBL<MyDayWebServiceBL>().GetWorkItemByI3D(5).ThrowIfError();
|
|
this.Verifier.Verify("WorkItemByI3D", workItem);
|
|
}
|
|
}
|
|
}
|
|
}
|