public void should_generate_correct_ascending_string_representation() { var setting = new SortSettings { SortAscending = true, PropertyName = nameof(SortSettings), ThenBy = null }; var sut = setting.ToSqlOrderBy(); sut.Equals( $"order by [{nameof(SortSettings)}] asc", StringComparison.InvariantCultureIgnoreCase ).Should().BeTrue(); }
public void generates_correct_sql_when_then_by_sort_has_alias() { var setting = new SortSettings { SortAscending = false, PropertyName = nameof(SortSettings), ThenBy = new SortSettings { SortAscending = true, PropertyName = nameof(SortSettings.SortAscending), PropertyTableAlias = "p" } }; var sut = setting.ToSqlOrderBy(); sut.Equals( $"order by [{nameof(SortSettings)}] desc, [p].[{nameof(SortSettings.SortAscending)}] asc", StringComparison.InvariantCultureIgnoreCase ).Should().BeTrue(); }