using System.Collections.Generic; using Centron.BusinessLogic.WebServices.Sales.Receipts; using Centron.BusinessLogic.WebServices.Sales.Receipts.ReceiptSearch; using Centron.Interfaces; using Centron.Interfaces.BL; using Centron.Interfaces.Sales.Receipts.ReceiptSearch; using Centron.Tests.EndToEnd.Infrastructure; using Xunit; using Xunit.Abstractions; namespace Centron.Tests.EndToEnd.TicketTests.Ticket145683; public class Ticket145683Tests : EndToEndTest { public Ticket145683Tests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { this.Verifier.Settings.CleanupDateTimeValues = false; } public override void Execute() { // In this ticket the problem was, that we got a wrong ExportDate for a invoice // Turns out, there were credit-vouchers with the same number as the invoice, and then it took the wrong date from the credit-voucher this.PrepareDatabase(); var filter = new ReceiptSearchFilter { ReceiptKinds = new List { CentronObjectKindNumeric.InvoiceClass, }, ReceiptNumber = 40280, }; var invoices = this.WithSession(s => s.GetBL() .SearchReceipts(this.GetLoggedInUser(), filter, 1, 10)).ThrowIfError(); var invoice = Assert.Single(invoices.Result); this.Verifier.Verify("ExportDate", invoice.ExportDate); } private void PrepareDatabase() { // Insert a credit-voucher with same receipt-number as the invoice this.Sql($""" INSERT INTO PORTRECH (Rechnungsnummer, Rechnungsdatum, Datum, Kundennummer, MandantenkredNr, PersonalI3D, PCName, PCIP, AnlageVersion, CentronVersion, Art, AnlageI3D) VALUES (40280, '20171004', '20160101', 10000, 2, 44, 'Some-Computer', '127.0.0.1', 1, '1.0.0.0', 6, 1) """); } }