Skip to content

Commit 2284f92

Browse files
authored
Merge pull request #186 from cnblogs/add-title
test: add title limit
2 parents 29c60dc + 475aeca commit 2284f92

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

test/Cnblogs.Architecture.UnitTests/Infrastructure/FakeObjects/FakeBlog.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ public class FakeBlog : Entity<int>, IAggregateRoot
88

99
// navigations
1010
public List<FakePost> Posts { get; set; } = null!;
11-
}
11+
}

test/Cnblogs.Architecture.UnitTests/Infrastructure/FakeObjects/FakeDbContext.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
1414
{
1515
modelBuilder.Entity<FakeBlog>().HasKey(x => x.Id);
1616
modelBuilder.Entity<FakeBlog>().Property(x => x.Id).ValueGeneratedOnAdd();
17+
modelBuilder.Entity<FakeBlog>().Property(x => x.Title).HasMaxLength(30);
1718
modelBuilder.Entity<FakeBlog>().HasMany(x => x.Posts).WithOne(x => x.Blog).HasForeignKey(x => x.BlogId);
1819

1920
modelBuilder.Entity<FakePost>().HasKey(x => x.Id);
2021
modelBuilder.Entity<FakePost>().Property(x => x.Id).ValueGeneratedOnAdd();
22+
modelBuilder.Entity<FakePost>().Property(x => x.Title).HasMaxLength(100);
2123
modelBuilder.Entity<FakePost>().HasMany(x => x.Tags).WithOne().HasForeignKey(x => x.PostId);
2224

2325
modelBuilder.Entity<FakeTag>().HasKey(x => x.Id);

0 commit comments

Comments
 (0)