using Centron.Data.Entities.Accounts; using FluentNHibernate.Mapping; namespace Centron.Tests.BL.DatabaseMappings { /// /// IMPORTANT: This is a replacement class for the real class for running in-memory unit tests. /// The real mapping maps to a database view (cvw_AccountSearchAcc) which cannot be created in an in-memory SQLite database. /// This test mapping creates a simple table with only the columns needed for the tests. /// Make sure to keep this class in sync with the columns needed for your tests. /// public class AccountSearchItemAccMapsForTest : ClassMap { public AccountSearchItemAccMapsForTest() { // Mark as read-only like the production mapping ReadOnly(); // Use a simple table name instead of the view name Table("AccountSearchItemAccTest"); // Map RowNumber as the ID (same as production mapping) // Using Assigned generator since we won't be inserting via NHibernate Id(m => m.RowNumber).Column("RowNumber").GeneratedBy.Assigned(); // Map AccountI3D as I3D (this is how it's queried in SetAccountReferenceProperties) // This is the key property that the business logic queries by Map(m => m.I3D).Column("AccountI3D"); // Map the columns used in SetAccountReferenceProperties Map(m => m.CustomerNumber).Column("CustomerNumber").Nullable(); Map(m => m.SupplierNumber).Column("SupplierNumber").Nullable(); // Additional commonly used columns - add more as needed for tests Map(m => m.AccountNumber).Column("AccountNumber").Nullable(); Map(m => m.AccountName).Column("AccountName").Nullable(); Map(m => m.IsActive).Column("IsActive").Nullable(); } } }