using Centron.BusinessLogic.WebServices.Sales.Receipts; using Centron.Data.WebServices.Sales.Receipts.CreditVouchers; using Centron.Interfaces; using Centron.Interfaces.BL; using Centron.Tests.EndToEnd.Infrastructure; using Xunit; using Xunit.Abstractions; namespace Centron.Tests.EndToEnd.TicketTests.Ticket136409; public class Ticket136409Test : EndToEndTest { public Ticket136409Test(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { } public const int CreditVoucherI3D = 2; public const string Address = "Some address"; public const int CustomerI3D = 10000; public const int AddressI3D = 3; public const int ContactPersonI3D = 4; public override void Execute() { this.PrepareDatabase(); // In this ticket the problem was, that for ReceiptCreditVoucher, the DeliveryAddress and InvoiceAddress were not mapped for loading var creditVoucher = (ReceiptCreditVoucherDTO)this.WithSession(s => s.GetBL().GetReceiptByI3D(CreditVoucherI3D, CentronObjectKindNumeric.CreditVoucherClass)).ThrowIfError(); Assert.Equal(Address, creditVoucher.DeliveryAddress); Assert.Equal(CustomerI3D, creditVoucher.DeliveryAddressCustomerI3D); Assert.Equal(AddressI3D, creditVoucher.DeliveryAddressAddressI3D); Assert.Equal(ContactPersonI3D, creditVoucher.DeliveryAddressContactPersonI3D); Assert.Equal(Address, creditVoucher.InvoiceAddress); Assert.Equal(CustomerI3D, creditVoucher.InvoiceAddressCustomerI3D); Assert.Equal(AddressI3D, creditVoucher.InvoiceAddressAddressI3D); Assert.Equal(ContactPersonI3D, creditVoucher.InvoiceAddressContactPersonI3D); } private void PrepareDatabase() { this.Sql($"UPDATE dbo.GutKopf SET LiefKundEmpfaenger = '{Address}', LiefKundI3D = {CustomerI3D}, LiefKundAnschriftI3D = {AddressI3D}, LiefKundPersonI3D = {ContactPersonI3D} WHERE I3D = {CreditVoucherI3D}"); this.Sql($"UPDATE dbo.GutKopf SET RechKundEmpfaenger = '{Address}', RechKundI3D = {CustomerI3D}, RechKundAnschriftI3D = {AddressI3D}, RechKundPersonI3D = {ContactPersonI3D} WHERE I3D = {CreditVoucherI3D}"); } }