using System; using System.Globalization; using System.Linq; using Centron.BusinessLogic; using Centron.BusinessLogic.ToDoArea; using Centron.BusinessLogic.WebServices.ToDoArea; using Centron.Data.Entities.ToDoArea; using Centron.Interfaces.BL; using Centron.Tests.EndToEnd.Infrastructure; using Xunit; using Xunit.Abstractions; namespace Centron.Tests.EndToEnd.Tests.Todo { public class TodoTests : EndToEndTest { public TodoTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { } public override void Execute() { this.GetAllTodos("AllActiveTodos"); this.GetTodoWithReceiptState(); this.TestDataQualityTodoListPart(); } private void GetAllTodos(string name) { using (var bl = new BLSession()) { var date = new DateTime(2020, 1, 1); var filter = new ToDoFilter { WithDiscarded = false, OnlyOwn = false, ToDate = date }; var todos = bl.GetBL().SearchTodoList(this.GetLoggedInUser().User, ToDoSort.Number, false, filter).OrderBy(o => o.I3D); this.Verifier.Verify(name, todos); } } private void GetTodoWithReceiptState() { this.Sql(@"UPDATE O SET O.ReceiptUserStateI3D = 1 FROM AngKopf O WHERE O.I3D = 6692"); this.Sql(@"UPDATE O SET O.ReceiptUserStateI3D = 1 FROM AufKopf O WHERE O.I3D = 3343"); this.Sql(@"UPDATE O SET O.ReceiptUserStateI3D = 1 FROM RechKopf O WHERE O.I3D = 1375"); this.Sql(@"UPDATE O SET O.ReceiptUserStateI3D = 1 FROM VertragKopf O WHERE O.I3D = 35"); this.GetAllTodos("ReceiptUserStateTodos"); } private void TestDataQualityTodoListPart() { using var bl = new BLSession(); bl.GetBL().DataQualityFillAccountI3D(); Verifier.VerifySql("TodoTests_TestDataQualityTodoListPart", "SELECT I3D, ObjektArt, KundeI3D, AccountI3D FROM TodoListe WHERE ObjektArt IN (7,148) ORDER BY I3D"); } } }