in EsentInteropTests/ContentEquatableTests.cs [559:760]
public void VerifyJetTablecreateEquality()
{
var columncreatesX = new[]
{
new JET_COLUMNCREATE
{
szColumnName = "col1_short",
coltyp = JET_coltyp.Short,
cbMax = 2,
},
new JET_COLUMNCREATE
{
szColumnName = "col2_longtext",
coltyp = JET_coltyp.LongText,
cp = JET_CP.Unicode,
},
};
const string Index1NameX = "firstIndex";
const string Index1DescriptionX = "+col1_short\0-col2_longtext\0";
const string Index2NameX = "secondIndex";
const string Index2DescriptionX = "+col2_longtext\0-col1_short\0";
var spacehintsIndexX = new JET_SPACEHINTS
{
ulInitialDensity = 33,
cbInitial = 4096,
grbit = SpaceHintsGrbit.CreateHintAppendSequential | SpaceHintsGrbit.RetrieveHintTableScanForward,
ulMaintDensity = 44,
ulGrowth = 144,
cbMinExtent = 1024 * 1024,
cbMaxExtent = 3 * 1024 * 1024,
};
var spacehintsSeqX = new JET_SPACEHINTS
{
ulInitialDensity = 33,
cbInitial = 4096,
grbit = SpaceHintsGrbit.CreateHintAppendSequential | SpaceHintsGrbit.RetrieveHintTableScanForward,
ulMaintDensity = 44,
ulGrowth = 144,
cbMinExtent = 1024 * 1024,
cbMaxExtent = 3 * 1024 * 1024,
};
var spacehintsLvX = new JET_SPACEHINTS
{
ulInitialDensity = 33,
cbInitial = 4096,
grbit = SpaceHintsGrbit.CreateHintAppendSequential | SpaceHintsGrbit.RetrieveHintTableScanForward,
ulMaintDensity = 44,
ulGrowth = 144,
cbMinExtent = 1024 * 1024,
cbMaxExtent = 3 * 1024 * 1024,
};
var indexcreatesX = new[]
{
new JET_INDEXCREATE
{
szIndexName = Index1NameX,
szKey = Index1DescriptionX,
cbKey = Index1DescriptionX.Length + 1,
grbit = CreateIndexGrbit.None,
ulDensity = 99,
pSpaceHints = spacehintsIndexX,
},
new JET_INDEXCREATE
{
szIndexName = Index2NameX,
szKey = Index2DescriptionX,
cbKey = Index2DescriptionX.Length + 1,
grbit = CreateIndexGrbit.None,
ulDensity = 79,
},
};
JET_TABLEID tableidTemp = new JET_TABLEID()
{
Value = (IntPtr)2,
};
var tablecreateX = new JET_TABLECREATE
{
szTableName = "tableBigBang",
ulPages = 23,
ulDensity = 75,
cColumns = columncreatesX.Length,
rgcolumncreate = columncreatesX,
rgindexcreate = indexcreatesX,
cIndexes = indexcreatesX.Length,
cbSeparateLV = 100,
cbtyp = JET_cbtyp.Null,
grbit = CreateTableColumnIndexGrbit.TemplateTable,
pSeqSpacehints = spacehintsSeqX,
pLVSpacehints = spacehintsLvX,
tableid = tableidTemp,
cCreated = 7,
};
var columncreatesY = new[]
{
new JET_COLUMNCREATE
{
szColumnName = "col1_short",
coltyp = JET_coltyp.Short,
cbMax = 2,
},
new JET_COLUMNCREATE
{
szColumnName = "col2_longtext",
coltyp = JET_coltyp.LongText,
cp = JET_CP.Unicode,
},
new JET_COLUMNCREATE
{
szColumnName = "col3_ignored",
},
};
const string Index1NameY = "firstIndex";
const string Index1DescriptionY = "+col1_short\0-col2_longtext\0";
const string Index2NameY = "secondIndex";
const string Index2DescriptionY = "+col2_longtext\0-col1_short\0";
var spacehintsIndexY = new JET_SPACEHINTS
{
ulInitialDensity = 33,
cbInitial = 4096,
grbit = SpaceHintsGrbit.CreateHintAppendSequential | SpaceHintsGrbit.RetrieveHintTableScanForward,
ulMaintDensity = 44,
ulGrowth = 144,
cbMinExtent = 1024 * 1024,
cbMaxExtent = 3 * 1024 * 1024,
};
var spacehintsSeqY = new JET_SPACEHINTS
{
ulInitialDensity = 33,
cbInitial = 4096,
grbit = SpaceHintsGrbit.CreateHintAppendSequential | SpaceHintsGrbit.RetrieveHintTableScanForward,
ulMaintDensity = 44,
ulGrowth = 144,
cbMinExtent = 1024 * 1024,
cbMaxExtent = 3 * 1024 * 1024,
};
var spacehintsLvY = new JET_SPACEHINTS
{
ulInitialDensity = 33,
cbInitial = 4096,
grbit = SpaceHintsGrbit.CreateHintAppendSequential | SpaceHintsGrbit.RetrieveHintTableScanForward,
ulMaintDensity = 44,
ulGrowth = 144,
cbMinExtent = 1024 * 1024,
cbMaxExtent = 3 * 1024 * 1024,
};
var indexcreatesY = new[]
{
new JET_INDEXCREATE
{
szIndexName = Index1NameY,
szKey = Index1DescriptionY,
cbKey = Index1DescriptionY.Length + 1,
grbit = CreateIndexGrbit.None,
ulDensity = 99,
pSpaceHints = spacehintsIndexY,
},
new JET_INDEXCREATE
{
szIndexName = Index2NameY,
szKey = Index2DescriptionY,
cbKey = Index2DescriptionY.Length + 1,
grbit = CreateIndexGrbit.None,
ulDensity = 79,
},
null,
};
var tablecreateY = new JET_TABLECREATE()
{
szTableName = "tableBigBang",
ulPages = 23,
ulDensity = 75,
cColumns = columncreatesX.Length,
rgcolumncreate = columncreatesY,
rgindexcreate = indexcreatesY,
cIndexes = indexcreatesX.Length,
cbSeparateLV = 100,
cbtyp = JET_cbtyp.Null,
grbit = CreateTableColumnIndexGrbit.TemplateTable,
pSeqSpacehints = spacehintsSeqY,
pLVSpacehints = spacehintsLvY,
tableid = tableidTemp,
cCreated = 7,
};
TestContentEquals(tablecreateX, tablecreateY);
}