public void NullValueString(EnumKeyDataType dataType) { var key = new BtrieveKey { Segments = new List <BtrieveKeyDefinition> { new BtrieveKeyDefinition { Number = 0, Offset = 2, Length = 8, DataType = dataType, Attributes = EnumKeyAttributeMask.UseExtendedDataType | EnumKeyAttributeMask.NullAllSegments, Segment = true, SegmentIndex = 0, NullValue = (byte)' ', } } }; var record = new byte[128]; Array.Fill(record, (byte)0xFF, 0, record.Length); // first segment is all spaces i.e. null Array.Fill(record, (byte)' ', 2, 8); var sqlLiteObject = key.ExtractKeyInRecordToSqliteObject(record); sqlLiteObject.Should().Be(DBNull.Value); }
public void PositiveIntegerTypeConversion(ushort length, EnumKeyDataType type, object expected) { var key = new BtrieveKey { Segments = new List <BtrieveKeyDefinition> { new BtrieveKeyDefinition { Number = 0, Offset = 0, Length = length, DataType = type, Attributes = EnumKeyAttributeMask.UseExtendedDataType, Segment = false, SegmentIndex = 0, NullValue = 0, } }, }; key.KeyDataToSqliteObject(DATA_POSITIVE.AsSpan().Slice(0, length)).Should().Be(expected); }