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
156 lines
6.5 KiB
C#
156 lines
6.5 KiB
C#
using Centron.BusinessLogic;
|
|
using Centron.BusinessLogic.EmployeeArea;
|
|
using Centron.BusinessLogic.TaskManager;
|
|
using Centron.BusinessLogic.WebServices.TaskManager;
|
|
using Centron.Data.Entities.TaskManager;
|
|
using Centron.Data.WebServices.Sales.Customers;
|
|
using Centron.Data.WebServices.TaskManager;
|
|
using Centron.Data.WebServices.TaskManager.Actions;
|
|
using Centron.Data.WebServices.TaskManager.Recurrence;
|
|
using Centron.Interfaces.CustomerArea;
|
|
using Centron.Tests.EndToEnd.Infrastructure;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace Centron.Tests.EndToEnd.Tests.TaskReportAction
|
|
{
|
|
public class TaskReportActionTest : EndToEndTest
|
|
{
|
|
public const int CustomerI3D = 10022;
|
|
|
|
public TaskReportActionTest(ITestOutputHelper testOutputHelper)
|
|
: base(testOutputHelper)
|
|
{
|
|
// We have a bit of flakiness with this property, if the code is VERY FAST, it will be the same value as CreatedDate and ChangedDate
|
|
// But if the code is a bit slower, it will get a different value, and the Verifier will treat it as an error
|
|
// It's annoying, and I don't wanna deal with this issue right now, so ignore the property for now
|
|
this.Verifier.Settings.IgnoreProperty<TaskManagementTaskDTO>(f => f.ChangedDate);
|
|
this.Verifier.Settings.IgnoreProperty<TaskManagementTaskDTO>(f => f.CreatedDate);
|
|
}
|
|
|
|
public override void Execute()
|
|
{
|
|
var taskI3D = this.CreateTask();
|
|
var task = this.LoadTask(taskI3D);
|
|
this.ChangeTask(task);
|
|
}
|
|
|
|
private int CreateTask()
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
var user = session.GetBL<AppUserBL>().GetAppUser(f => f.I3D == 11);
|
|
var task = new TaskManagementTaskDTO
|
|
{
|
|
Name = "Test-Task Report-Server",
|
|
Description = "Test-Task mit Report-Action",
|
|
Status = ProjectStatus.Finished,
|
|
Action = new TaskManagementReportActionDTO
|
|
{
|
|
Customer = new CustomerPreviewDTO
|
|
{
|
|
I3D = CustomerI3D
|
|
},
|
|
MailSubject = "Betreff",
|
|
MailBodyAsRtf = "Some...body ONCE TOLD ME",
|
|
Reports = new List<TaskManagementActionReportDTO>
|
|
{
|
|
new TaskManagementActionReportDTO
|
|
{
|
|
ReportDataI3D = 123
|
|
},
|
|
new TaskManagementActionReportDTO
|
|
{
|
|
ReportDataI3D = 234
|
|
},
|
|
},
|
|
MailReceiver = new List<TaskManagementActionCustomerMailRecipientDTO>
|
|
{
|
|
new TaskManagementActionCustomerMailRecipientDTO
|
|
{
|
|
ContactPersonI3D = 25,
|
|
Adviser = null,
|
|
EmailAddress = null,
|
|
DepartmentI3D = null,
|
|
},
|
|
new TaskManagementActionCustomerMailRecipientDTO
|
|
{
|
|
ContactPersonI3D = null,
|
|
Adviser = AdviserType.Adviser1,
|
|
EmailAddress = null,
|
|
DepartmentI3D = null,
|
|
},
|
|
new TaskManagementActionCustomerMailRecipientDTO
|
|
{
|
|
ContactPersonI3D = null,
|
|
Adviser = null,
|
|
EmailAddress = "test@c-entron.de",
|
|
DepartmentI3D = null,
|
|
},
|
|
new TaskManagementActionCustomerMailRecipientDTO
|
|
{
|
|
ContactPersonI3D = null,
|
|
Adviser = null,
|
|
EmailAddress = null,
|
|
DepartmentI3D = 3,
|
|
},
|
|
}
|
|
},
|
|
Recurrence = new TaskManagementDailyRecurrenceDTO
|
|
{
|
|
AppointmentStart = new DateTime(2020, 2, 2, 13, 0, 0),
|
|
StartTime = new DateTime(2020, 2, 2, 13, 0, 0),
|
|
EveryWeekday = true
|
|
},
|
|
};
|
|
|
|
var savedTask = session.GetBL<TaskManagementTaskWebServiceBL>().SaveOrUpdateTask(task, user);
|
|
|
|
this.Verifier.Verify("SavedTask", savedTask);
|
|
|
|
return savedTask.Data.I3D;
|
|
}
|
|
}
|
|
|
|
|
|
private TaskManagementTaskDTO LoadTask(int taskI3D)
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
var tasks = session.GetBL<TaskManagementTaskWebServiceBL>().GetTasks(1, 1, new GetTasksFilter { I3Ds = new[] { taskI3D } });
|
|
this.Verifier.Verify("LoadedTask", tasks);
|
|
|
|
return tasks.Data.Result.Single();
|
|
}
|
|
}
|
|
|
|
private void ChangeTask(TaskManagementTaskDTO task)
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
var action = (TaskManagementReportActionDTO)task.Action;
|
|
action.Reports[0].ReportDataI3D = 999; //Edit
|
|
action.Reports.Remove(action.Reports.Last()); //Delete
|
|
action.Reports.Add(new TaskManagementActionReportDTO //Add
|
|
{
|
|
ReportDataI3D = 555
|
|
});
|
|
|
|
action.MailReceiver[0].ContactPersonI3D = 333; //Edit
|
|
action.MailReceiver.Remove(action.MailReceiver.Last()); //Delete
|
|
action.MailReceiver.Add(new TaskManagementActionCustomerMailRecipientDTO //Add
|
|
{
|
|
DepartmentI3D = 4
|
|
});
|
|
|
|
var user = session.GetBL<AppUserBL>().GetAppUser(f => f.I3D == 11);
|
|
var updatedTask = session.GetBL<TaskManagementTaskWebServiceBL>().SaveOrUpdateTask(task, user);
|
|
|
|
this.Verifier.Verify("UpdatedTask", updatedTask);
|
|
}
|
|
}
|
|
}
|
|
}
|