public override SqlRandomTableColumn CreateRandomColumn(SqlRandomizer rand, SqlRandomColumnOptions options) { int size = rand.NextAllocationSizeBytes(2, MaxCharSize * 2); size = size & 0xFFFE; // clean last bit to make it even return(new SqlRandomTableColumn(this, options, size)); }
protected override object CreateRandomValueInternal(SqlRandomizer rand, SqlRandomTableColumn columnInfo) { if ((columnInfo.Options & SqlRandomColumnOptions.ColumnSet) != 0) { // use the sparse columns themselves to insert values // testing column set column correctness is not a goal for the stress test throw new NotImplementedException("should not use this method for column set columns"); } int charSize = rand.NextAllocationSizeBytes(0, columnInfo.StorageSize); const string prefix = "<x>"; const string suffix = "</x>"; if (charSize > (prefix.Length + suffix.Length)) { string randValue = new string('a', charSize - (prefix.Length + suffix.Length)); return(string.Format("<x>{0}</x>", randValue).ToCharArray()); } else { // for accurate comparison, use the short form return("<x />".ToCharArray()); } }
public override SqlRandomTableColumn CreateRandomColumn(SqlRandomizer rand, SqlRandomColumnOptions options) { int size = rand.NextAllocationSizeBytes(1, MaxCharSize); return(new SqlRandomTableColumn(this, options, size)); }