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
177 lines
5.9 KiB
C#
177 lines
5.9 KiB
C#
using Centron.BusinessLogic.WebServices;
|
|
using Centron.DAO.Mappings.Sales.Receipts;
|
|
using Centron.DAO.Mappings.Sales.Receipts.Invoices;
|
|
using Centron.Data.Entities.Sales.Receipts;
|
|
using Centron.Data.Entities.Sales.Receipts.Invoices;
|
|
using Centron.Data.WebServices.Sales.Receipts.Invoices;
|
|
using Centron.Interfaces.Administration.Environment;
|
|
using Centron.Interfaces.Sales.Receipts;
|
|
using Centron.Interfaces.Sales.Receipts.Invoices;
|
|
using FluentNHibernate.Cfg;
|
|
using FluentNHibernate.Cfg.Db;
|
|
using NHibernate;
|
|
using NHibernate.Tool.hbm2ddl;
|
|
|
|
namespace Centron.Tests.DAO.Mappings.Sales.Receipts;
|
|
|
|
public class ReceiptBaseMapsTest
|
|
{
|
|
|
|
[Fact]
|
|
public void ReceiptReceiverCanBeMapped()
|
|
{
|
|
var session = CreateSession();
|
|
var receipt = new ReceiptInvoice()
|
|
{
|
|
I3D = 1,
|
|
CustomerI3D = 10,
|
|
Information = "Information",
|
|
ShowInformation = false,
|
|
|
|
IsCashAsset = false,
|
|
|
|
PurchaseOrderNumber = "12345",
|
|
|
|
AdditionalText = "Additional text",
|
|
|
|
ProjectNumber = "123456",
|
|
DeliveryConditionText = "",
|
|
PaymentConditionText = "",
|
|
|
|
DeliveryAddress = "Delivery address",
|
|
DeliveryAddressInformation = "",
|
|
|
|
InvoiceAddress = "Invoice address",
|
|
InvoiceAddressInformation = "",
|
|
|
|
LicenseeAddress = "Licensee address",
|
|
LicenseeAddressInformation = "",
|
|
|
|
IsPartialDeliveryPossible = false,
|
|
|
|
EsrAmount = "1",
|
|
EsrCodelineAmount = "1",
|
|
EsrReferenceNumber = "123",
|
|
|
|
IsFixed = false,
|
|
|
|
UsedAlternativeDeliveryAddress = false,
|
|
|
|
UsedAlternativeInvoiceAddress = false,
|
|
|
|
Provision = new List<ReceiptProvision>(),
|
|
|
|
PaidFC = 2,
|
|
ExternalInvoiceNumber = "345",
|
|
|
|
CurrencyFactorIsFixed = true,
|
|
|
|
CollectiveAccount = "Collective account",
|
|
|
|
TrackingNumber = "567",
|
|
TrackingNumberURL = "TrackURL",
|
|
Number = 2,
|
|
Date = DateTime.Now,
|
|
Version = 1,
|
|
State = ReceiptState.Active,
|
|
BranchOrigin = BranchOrigin.Creator,
|
|
|
|
|
|
CurrencyFactor = 1,
|
|
CurrencyString = "€",
|
|
ExclusiveOfVAT = false,
|
|
|
|
Receiver = "Receiver",
|
|
Phone = "12345",
|
|
Fax = "12345",
|
|
Email = "mail@a.com",
|
|
|
|
Street = "Street",
|
|
HasPostOfficeBox = false,
|
|
PostOfficeBox = "",
|
|
Zip = "12345",
|
|
City = "City",
|
|
ContactName = "Contact name",
|
|
|
|
CreatedThroughApplicationVersion = "2.0.2504.5",
|
|
ChangedThroughApplicationVersion = "",
|
|
ChangedThroughApplication = CreatedThroughApplication.WebServices,
|
|
|
|
ConcurrencyControlGuid = Guid.NewGuid(),
|
|
ReceiptReceiver = new ReceiptReceiver()
|
|
{
|
|
CompanyName = "Company",
|
|
Department = "Department",
|
|
ContactName = "Contact",
|
|
ContactDepartment = "C Department",
|
|
Street = "Street",
|
|
HouseNumber = "1",
|
|
Zip = "12345",
|
|
City = "City",
|
|
Country = "Country",
|
|
CountryI3D = 4,
|
|
PostOfficeBox = "",
|
|
HasPostOfficeBox = false,
|
|
AdditionalAddressSupplement = ""
|
|
},
|
|
ReceiptReceiverInvoice = new ReceiptReceiver()
|
|
{
|
|
CompanyName = "Company",
|
|
Department = "Department",
|
|
ContactName = "Contact",
|
|
ContactDepartment = "C Department",
|
|
Street = "Street Invoice",
|
|
HouseNumber = "1",
|
|
Zip = "12345",
|
|
City = "City",
|
|
Country = "Country",
|
|
CountryI3D = 4,
|
|
PostOfficeBox = "",
|
|
HasPostOfficeBox = false,
|
|
AdditionalAddressSupplement = ""
|
|
}
|
|
,
|
|
ReceiptReceiverLicense = new ReceiptReceiver()
|
|
{
|
|
CompanyName = "Company License",
|
|
Department = "Department",
|
|
ContactName = "Contact",
|
|
ContactDepartment = "C Department",
|
|
Street = "Street",
|
|
HouseNumber = "1",
|
|
Zip = "12345",
|
|
City = "City",
|
|
Country = "Country",
|
|
CountryI3D = 4,
|
|
PostOfficeBox = "",
|
|
HasPostOfficeBox = false,
|
|
AdditionalAddressSupplement = ""
|
|
}
|
|
};
|
|
session.Save(receipt);
|
|
session.Flush();
|
|
|
|
var savedEntity = session.Get<ReceiptInvoice>(1);
|
|
Assert.NotNull(savedEntity);
|
|
var dto = ObjectMapper.Map<IReceiptInvoice, ReceiptInvoiceDTO>(savedEntity);
|
|
Assert.NotNull(dto);
|
|
Assert.Equal("Company License", dto.ReceiptReceiverLicense.CompanyName);
|
|
var savedReceiptReceivers = session.Query<ReceiptReceiver>().ToList();
|
|
Assert.Equal(3, savedReceiptReceivers.Count);
|
|
}
|
|
|
|
public ISession CreateSession()
|
|
{
|
|
var fluentConfiguration = Fluently.Configure()
|
|
.Database(SQLiteConfiguration.Standard.InMemory)
|
|
.Mappings(m => m.FluentMappings.Add<ReceiptInvoiceMaps>())
|
|
.Mappings(m => m.FluentMappings.Add<ReceiptReceiverMaps>())
|
|
.Mappings(m => m.FluentMappings.Add<ReceiptInvoiceItemMaps>())
|
|
;
|
|
ISessionFactory sessionFactory = fluentConfiguration.BuildSessionFactory();
|
|
ISession session = sessionFactory.OpenSession();
|
|
|
|
new SchemaExport(fluentConfiguration.BuildConfiguration()).Execute(true, true, false, session.Connection, Console.Out);
|
|
return session;
|
|
}
|
|
} |