public void GetAutoGeneratedColumns_should_return_columns_that_are_auto_generated() { using (new IndirectionsContext()) { // Arrange PULColumns.ValidateStateULTableStatus().Body = args => null; var expected = new[] { new ULColumn("USER_ID"), new ULColumn("DELETED"), new ULColumn("CREATED"), new ULColumn("MODIFIED") }; var users = new ULTable("USER"); users.Columns.Add(expected[0]); users.Columns.Add(new ULColumn("PASSWORD")); users.Columns.Add(new ULColumn("USER_NAME")); users.Columns.Add(expected[1]); users.Columns.Add(expected[2]); users.Columns.Add(expected[3]); // Act var actual = users.GetAutoGeneratedColumns(); // Assert CollectionAssert.AreEqual(expected, actual); } }
public static IEnumerable <ULColumn> GetManuallyGeneratedColumns(this ULTable @this) { if (@this == null) { throw new ArgumentNullException("@this"); } var patterns = GetAutoGeneratedColumnNamePatterns(@this.TableName); return(@this.Columns.OfType <ULColumn>().Where(column => !patterns.Any(_ => _(column.Name)))); }