Skip to content

Commit 6d3d6d5

Browse files
committed
Fixed a bug in the Blog tests caused by the new EntityFramework change tracker (#326)
1 parent f1640ea commit 6d3d6d5

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

samples/Blog/Blog.Test/Data/ArticleTestData.cs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,14 @@
99
public static class ArticleTestData
1010
{
1111
public static List<Article> GetArticles(int count, bool isPublic = true, bool sameUser = true)
12-
=> Enumerable
12+
{
13+
var user = new User
14+
{
15+
Id = TestUser.Identifier,
16+
UserName = TestUser.Username
17+
};
18+
19+
var articles = Enumerable
1320
.Range(1, count)
1421
.Select(i => new Article
1522
{
@@ -18,12 +25,15 @@ public static List<Article> GetArticles(int count, bool isPublic = true, bool sa
1825
Content = $"Article Content {i}",
1926
IsPublic = isPublic,
2027
PublishedOn = isPublic ? new DateTime(2019, 1, 1) : default(DateTime?),
21-
User = new User
28+
User = sameUser ? user : new User
2229
{
23-
Id = sameUser ? TestUser.Identifier : $"Author Id {i}",
24-
UserName = sameUser ? TestUser.Username : $"Author {i}"
30+
Id = $"Author Id {i}",
31+
UserName = $"Author {i}"
2532
}
2633
})
2734
.ToList();
35+
36+
return articles;
37+
}
2838
}
2939
}

0 commit comments

Comments
 (0)