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
194 lines
8.0 KiB
C#
194 lines
8.0 KiB
C#
using System;
|
|
using System.Linq;
|
|
using Centron.BusinessLogic;
|
|
using Centron.BusinessLogic.WebServices.Accounts.Activities;
|
|
using Centron.BusinessLogic.WebServices.Mail.Templates;
|
|
using Centron.BusinessLogic.WebServices.Sales.Receipts;
|
|
using Centron.Controls.Shared;
|
|
using Centron.Data.Entities.Accounts.Activities;
|
|
using Centron.Data.WebServices.Mail.Templates;
|
|
using Centron.Interfaces;
|
|
using Centron.Interfaces.Accounts.Activities;
|
|
using Centron.Interfaces.BL;
|
|
using Centron.Tests.EndToEnd.Infrastructure;
|
|
using CentronSoftware.Centron.WebServices.Entities.Accounts.Activities;
|
|
using DevExpress.XtraRichEdit;
|
|
using Xunit;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace Centron.Tests.EndToEnd.Tests.AccountActivities;
|
|
|
|
public class AccountActivityTest : EndToEndTest
|
|
{
|
|
|
|
private int _centronAccountI3D = 1;
|
|
private int _celosAccountI3D = 1028;
|
|
|
|
private int _adminPersonalI3D = 22;
|
|
private int _thPersonalI3D = 27;
|
|
|
|
private int _dukeMartinAccountAddressContactI3D = 8;
|
|
private int _farmerElisabethAccountAddressContactI3D = 9;
|
|
|
|
private int _accountActivitiyI3D = 1117;
|
|
public AccountActivityTest(ITestOutputHelper testOutputHelper) : base(testOutputHelper)
|
|
{
|
|
this.Verifier.Settings.IgnoreProperty<AccountActivityDTO>(f => f.CreatedVersion);
|
|
this.Verifier.Settings.IgnoreProperty<AccountActivityDTO>(f => f.ChangedVersion);
|
|
this.Verifier.Settings.IgnoreColumn("Datum");
|
|
this.Verifier.Settings.IgnoreColumn("WiedervorlageDatum");
|
|
this.Verifier.Settings.IgnoreColumn("GeaendertDatum");
|
|
this.Verifier.Settings.IgnoreColumn("GeaendertDatumVersion");
|
|
this.Verifier.Settings.IgnoreColumn("ErstelltVersion");
|
|
this.Verifier.Settings.IgnoreColumn("GeaendertVersion");
|
|
}
|
|
|
|
[Fact(Skip = "This test is weirdly flaky, not sure why, but it's very annoying that PRs fail because of it")]
|
|
public override void Execute()
|
|
{
|
|
var accountActivityI3D = this.CreateAccountActivities();
|
|
this.UpdateAccountActivities(accountActivityI3D);
|
|
this.LoadAccountActivities();
|
|
this.LinkActivityWithReceipt(accountActivityI3D);
|
|
|
|
this.LoadMailForNote("FallbackMailBody");
|
|
this.CreateMailTemplatesForNote();
|
|
this.LoadMailForNote("NewMailTemplateMailBody");
|
|
|
|
}
|
|
|
|
private void CreateMailTemplatesForNote()
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
var mailTemplate = new MailTemplateDTO
|
|
{
|
|
Subject = "Was hat jemand der im Dreieck läuft?",
|
|
Body = TextHelper.PlainToRtf("Kreislaufprobleme."),
|
|
ObjectKind = (int) CentronObjectKindNumeric.AccountActivity,
|
|
SubObjectKind = (int) AccountActivityKind.Note,
|
|
IsActive = true
|
|
};
|
|
|
|
var saved = session.GetBL<MailTemplateWebServiceBL>().SaveOrUpdateMailTemplate(this.GetLoggedInUser(), mailTemplate);
|
|
|
|
Assert.NotNull(saved);
|
|
Assert.Equal(ResultStatus.Success, saved.Status);
|
|
}
|
|
}
|
|
|
|
private void LoadMailForNote(string name)
|
|
{
|
|
using (var session = new BLSession())
|
|
{
|
|
//random exisiting i3D
|
|
var mailTemplate = session.GetBL<AccountActivitiesWebServiceBL>().GetCrmMailTemplate(1166, "test@c-entron.de", this.GetLoggedInUser());
|
|
|
|
Assert.NotNull(mailTemplate);
|
|
Assert.Equal(ResultStatus.Success, mailTemplate.Status);
|
|
|
|
this.Verifier.Verify(name, TextHelper.RtfToPlain(mailTemplate.Data.FirstOrDefault().Body.Text));
|
|
}
|
|
}
|
|
|
|
private int CreateAccountActivities()
|
|
{
|
|
var zeroDTO = new AccountActivityDTO
|
|
{
|
|
Caption = "What did the Cannibal get when he was late to the feast?",
|
|
Text = "The cold shoulder"
|
|
};
|
|
//this should return an error
|
|
var zeroResult = this.WithSession(f => f.GetBL<AccountActivitiesWebServiceBL>().SaveAccountActivity(zeroDTO, this.GetLoggedInUser()));
|
|
|
|
this.Verifier.Verify("00_FailedSaving", zeroResult);
|
|
|
|
|
|
var oneDTO = new AccountActivityDTO
|
|
{
|
|
Caption = "Why are murders in Kentucky so hard to solve?",
|
|
Text = "Because there are no dental records and all the DNA matches.",
|
|
AccountI3D = _centronAccountI3D,
|
|
EditorI3D = _adminPersonalI3D,
|
|
AccountAddressContactI3D = _dukeMartinAccountAddressContactI3D,
|
|
ActivityKind = AccountActivityKind.Note
|
|
};
|
|
|
|
var oneResult = this.WithSession(f => f.GetBL<AccountActivitiesWebServiceBL>().SaveAccountActivity(oneDTO, this.GetLoggedInUser()));
|
|
|
|
this.Verifier.Verify("01_SuccessfulSaving1", oneResult);
|
|
|
|
var twoDTO = new AccountActivityDTO
|
|
{
|
|
Caption = "What did the teddy bear eat for lunch?",
|
|
Text = "Nothing, he was stuffed.",
|
|
AccountI3D = _celosAccountI3D,
|
|
EditorI3D = _thPersonalI3D,
|
|
AccountAddressContactI3D = _farmerElisabethAccountAddressContactI3D,
|
|
ActivityKind = AccountActivityKind.Appointment,
|
|
DateFrom = new DateTime(2222, 2, 2),
|
|
DateTo = new DateTime(1111, 1, 1),
|
|
Rating = 4,
|
|
SyncWithOutlook = true,
|
|
};
|
|
|
|
var twoResult = this.WithSession(f => f.GetBL<AccountActivitiesWebServiceBL>().SaveAccountActivity(twoDTO, this.GetLoggedInUser()));
|
|
|
|
this.Verifier.Verify("02_SuccessfulSaving2", twoResult);
|
|
|
|
this.Verifier.VerifyTable("XX_TaetigkeitenTable", "Taetigkeiten");
|
|
|
|
return twoResult.Data.I3D;
|
|
}
|
|
|
|
private void UpdateAccountActivities(int i3DToUpdate)
|
|
{
|
|
var threeUpdateResult = this.WithSession(f => f.GetBL<AccountActivitiesWebServiceBL>().UpdateAccountActivity(i3DToUpdate, true, 2, this.GetLoggedInUser()));
|
|
this.Verifier.Verify("03_UpdateResult", threeUpdateResult);
|
|
}
|
|
|
|
private void LoadAccountActivities()
|
|
{
|
|
var oneFilter = new AccountActivitySearchFilter()
|
|
{
|
|
Caption = "bear",
|
|
IsDone = false,
|
|
};
|
|
var fourList = this.WithSession(f => f.GetBL<AccountActivitiesWebServiceBL>().SearchActivitiesThroughPaging(oneFilter, 1, Int32.MaxValue, this.GetLoggedInUser()));
|
|
|
|
this.Verifier.Verify("04_bearSearchResult", fourList);
|
|
|
|
var twoFilter = new AccountActivitySearchFilter
|
|
{
|
|
Caption = "teddy",
|
|
IsDone = true
|
|
};
|
|
|
|
var fiveList = this.WithSession(f => f.GetBL<AccountActivitiesWebServiceBL>().SearchActivitiesThroughPaging(twoFilter, 1, Int32.MaxValue, this.GetLoggedInUser()));
|
|
this.Verifier.Verify("05_closedSearchResult", fiveList);
|
|
}
|
|
|
|
private void LinkActivityWithReceipt(int inactiveAccountActivity)
|
|
{
|
|
var offerKind = CentronObjectKindNumeric.OrderClass;
|
|
var offerI3D = 1311;
|
|
|
|
var sixResult = this.WithSession(f => f.GetBL<ReceiptWebServiceBL>().SaveAccountActivityForReceipt(offerKind,offerI3D, inactiveAccountActivity));
|
|
this.Verifier.Verify("06_linkActivityWithReceipt1", sixResult);
|
|
|
|
var sevenResult = this.WithSession(f => f.GetBL<ReceiptWebServiceBL>().SaveAccountActivityForReceipt(offerKind, offerI3D, _accountActivitiyI3D));
|
|
this.Verifier.Verify("07_linkActivityWithReceipt2", sevenResult);
|
|
|
|
var eightList = this.WithSession(f => f.GetBL<ReceiptWebServiceBL>().GetAccountActivitiesForReceipt(offerKind, offerI3D, false));
|
|
this.Verifier.Verify("08_linkedAccountActivities", eightList);
|
|
|
|
var nineResult = this.WithSession(f => f.GetBL<ReceiptWebServiceBL>().DeleteAccountActivityForReceipt(eightList.Data.First()));
|
|
this.Verifier.Verify("09_deleteLinkedAccountActivityResult", nineResult);
|
|
|
|
var tenList = this.WithSession(f => f.GetBL<ReceiptWebServiceBL>().GetAccountActivitiesForReceipt(offerKind, offerI3D, false));
|
|
this.Verifier.Verify("10_linkedAccountActivitiesAfterDelete", tenList);
|
|
|
|
var elevenList = this.WithSession(f => f.GetBL<ReceiptWebServiceBL>().GetReceiptsForAccountActivity(inactiveAccountActivity));
|
|
this.Verifier.Verify("11_linkedAccountActivitiesReceipts", elevenList);
|
|
}
|
|
} |