Skip to content

Commit

Permalink
Test for issue #22092
Browse files Browse the repository at this point in the history
  • Loading branch information
AndriySvyryd committed Aug 18, 2020
1 parent bbde459 commit 9b52977
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
25 changes: 19 additions & 6 deletions test/EFCore.Specification.Tests/DataAnnotationTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2439,25 +2439,38 @@ protected override void Seed(PoolableDbContext context)
}
}

protected abstract class OneBase
{
public virtual int UniqueNo { get; set; }

public virtual Guid RowVersion { get; set; }

public virtual string IgnoredProperty { get; set; }

public virtual string RequiredColumn { get; set; }

public virtual string MaxLengthProperty { get; set; }
}

[Table("Sample")]
protected class One
protected class One : OneBase
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int UniqueNo { get; set; }
public override int UniqueNo { get; set; }

[ConcurrencyCheck]
public Guid RowVersion { get; set; }
public override Guid RowVersion { get; set; }

[NotMapped]
public string IgnoredProperty { get; set; }
public override string IgnoredProperty { get; set; }

[Required]
[Column("Name")]
public string RequiredColumn { get; set; }
public override string RequiredColumn { get; set; }

[MaxLength(10)]
public string MaxLengthProperty { get; set; }
public override string MaxLengthProperty { get; set; }

public Details Details { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,16 @@ public override ModelBuilder DatabaseGeneratedOption_configures_the_property_cor
return modelBuilder;
}

[ConditionalFact]
public virtual void ColumnAttribute_configures_the_property_correctly()
{
var modelBuilder = CreateModelBuilder();
modelBuilder.Entity<One>();

Assert.Equal("Name",
modelBuilder.Model.FindEntityType(typeof(One)).FindProperty(nameof(One.RequiredColumn)).GetColumnName());
}

public override ModelBuilder DatabaseGeneratedOption_Identity_does_not_throw_on_noninteger_properties()
{
var modelBuilder = base.DatabaseGeneratedOption_Identity_does_not_throw_on_noninteger_properties();
Expand Down

0 comments on commit 9b52977

Please sign in to comment.