Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept empty and emoji column names when reverse engineering #22900

Merged
merged 1 commit into from
Oct 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public virtual string GetPrincipalEndCandidateNavigationPropertyName(

private static string GenerateCandidateIdentifier(string originalIdentifier)
{
Check.NotEmpty(originalIdentifier, nameof(originalIdentifier));
Check.NotNull(originalIdentifier, nameof(originalIdentifier));

var candidateStringBuilder = new StringBuilder();
var previousLetterCharInWordIsLowerCase = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public class CSharpNamerTest
[InlineData("namespace", "_namespace")]
[InlineData("@namespace", "@namespace")]
[InlineData("8ball", "_8ball")]
[InlineData(" ", "_")]
[InlineData("", "_")]
public void Sanitizes_name_with_no_singularize_or_pluralize(string input, string output)
{
Assert.Equal(output, new CSharpNamer<string>(s => s, new CSharpUtilities(), null).GetName(input));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,15 @@ public void Generates_candidate_identifiers(string input, string output)
output, new CandidateNamingService().GenerateCandidateIdentifier(
new DatabaseTable { Database = new DatabaseModel(), Name = input }));
}

[ConditionalTheory]
[InlineData("‍🐶", "")]
[InlineData(" ", "")]
public void Generates_column_candidate_identifiers(string input, string output)
{
Assert.Equal(
output, new CandidateNamingService().GenerateCandidateIdentifier(
new DatabaseColumn { Name = input }));
}
}
}