private void assertIdentifierLengths(StoreOptions options) { foreach (var index in _mapping.Indexes) { options.AssertValidIdentifier(index.IndexName); } options.AssertValidIdentifier(_mapping.UpsertFunction.Name); options.AssertValidIdentifier(_mapping.Table.Name); }
public static void AssertValidNames(this ISchemaObject[] schemaObjects, StoreOptions options) { foreach (var objectName in schemaObjects.SelectMany(x => x.AllNames())) { options.AssertValidIdentifier(objectName.Name); } }
public void assert_identifier_null_or_whitespace() { var options = new StoreOptions(); Exception <PostgresqlIdentifierInvalidException> .ShouldBeThrownBy(() => { options.AssertValidIdentifier(null); }); for (var i = 0; i < options.NameDataLength; i++) { var text = new string(' ', i); Exception <PostgresqlIdentifierInvalidException> .ShouldBeThrownBy(() => { options.AssertValidIdentifier(text); }); } }
public void assert_identifier_length_exceeding_maximum() { var options = new StoreOptions(); var text = new string('a', options.NameDataLength); Exception <PostgresqlIdentifierTooLongException> .ShouldBeThrownBy(() => { options.AssertValidIdentifier(text); }); }
public void assert_identifier_length_happy_path() { var options = new StoreOptions(); for (var i = 1; i < options.NameDataLength; i++) { var text = new string('a', i); options.AssertValidIdentifier(text); } }
public void assert_identifier_must_not_contain_space() { var random = new Random(); var options = new StoreOptions(); for (var i = 1; i < options.NameDataLength; i++) { var text = new string('a', i); var position = random.Next(0, i); Exception <PostgresqlIdentifierInvalidException> .ShouldBeThrownBy(() => { options.AssertValidIdentifier(text.Remove(position).Insert(position, " ")); }); } }