private Song GetReviewerChainInstances(Article article, Blog sharedBlog, Person sharedBlogAuthor) { Person reviewer = PersonFaker.Generate(); article.Reviewer = reviewer; List <Blog> blogs = BlogFaker.Generate(1); blogs.Add(sharedBlog); reviewer.Blogs = blogs.ToHashSet(); blogs[0].Author = reviewer; Person author = PersonFaker.Generate(); blogs[1].Author = sharedBlogAuthor; Song authorSong = SongFaker.Generate(); author.FavoriteSong = authorSong; sharedBlogAuthor.FavoriteSong = authorSong; Song reviewerSong = SongFaker.Generate(); reviewer.FavoriteSong = reviewerSong; return(authorSong); }
private AuthorChainInstances GetAuthorChainInstances() { Article article = ArticleFaker.Generate(); Person author = PersonFaker.Generate(); article.Author = author; List <Blog> blogs = BlogFaker.Generate(2); author.Blogs = blogs.ToHashSet(); blogs[0].Reviewer = author; Person reviewer = PersonFaker.Generate(); blogs[1].Reviewer = reviewer; Food authorFood = FoodFaker.Generate(); author.FavoriteFood = authorFood; Food reviewerFood = FoodFaker.Generate(); reviewer.FavoriteFood = reviewerFood; return(new AuthorChainInstances(article, author, authorFood, reviewer, reviewerFood)); }
private (Article, Person, Food, Person, Food) GetAuthorChainInstances() { var article = ArticleFaker.Generate(); var author = PersonFaker.Generate(); article.Author = author; var blogs = BlogFaker.Generate(2); author.Blogs = blogs.ToHashSet(); blogs[0].Reviewer = author; var reviewer = PersonFaker.Generate(); blogs[1].Reviewer = reviewer; var authorFood = FoodFaker.Generate(); author.FavoriteFood = authorFood; var reviewerFood = FoodFaker.Generate(); reviewer.FavoriteFood = reviewerFood; return(article, author, authorFood, reviewer, reviewerFood); }
public MainWindowModel() { People = new ObservableCollection <Person>(PersonFaker.Generate(1)); AddRandomPerson = new RelayCommand(o => People.Add(PersonFaker.Generate())); ReloadColumnsCommand = new RelayCommand(o => { var dynamicDataGrid = Application.Current.MainWindow.TryFindChild <DynamicDataGrid>(); dynamicDataGrid.ReloadColumns(); }); }
public BeforeDeleteWithDbValuesTests() { _person = PersonFaker.Generate(); var todo1 = TodoFaker.Generate(); var todo2 = TodoFaker.Generate(); var passport = PassportFaker.Generate(); _person.Passport = passport; _person.TodoItems = new HashSet <TodoItem> { todo1 }; _person.StakeHolderTodoItem = todo2; _options = InitInMemoryDb(context => { context.Set <Person>().Add(_person); context.SaveChanges(); }); }
public void BuildIncluded_DuplicateChildrenMultipleChains_OnceInOutput() { Person person = PersonFaker.Generate(); List <Article> articles = ArticleFaker.Generate(5); articles.ForEach(article => article.Author = person); articles.ForEach(article => article.Reviewer = person); IncludedResourceObjectBuilder builder = GetBuilder(); IReadOnlyCollection <RelationshipAttribute> authorChain = GetIncludedRelationshipsChain("author"); IReadOnlyCollection <RelationshipAttribute> reviewerChain = GetIncludedRelationshipsChain("reviewer"); foreach (Article article in articles) { builder.IncludeRelationshipChain(authorChain, article); builder.IncludeRelationshipChain(reviewerChain, article); } IList <ResourceObject> result = builder.Build(); Assert.Single(result); Assert.Equal(person.Name, result[0].Attributes["name"]); Assert.Equal(person.Id.ToString(), result[0].Id); }
public void BuildIncluded_DuplicateChildrenMultipleChains_OnceInOutput() { var person = PersonFaker.Generate(); var articles = ArticleFaker.Generate(5); articles.ForEach(a => a.Author = person); articles.ForEach(a => a.Reviewer = person); var builder = GetBuilder(); var authorChain = GetIncludedRelationshipsChain("author"); var reviewerChain = GetIncludedRelationshipsChain("reviewer"); foreach (var article in articles) { builder.IncludeRelationshipChain(authorChain, article); builder.IncludeRelationshipChain(reviewerChain, article); } var result = builder.Build(); Assert.Single(result); Assert.Equal(person.Name, result[0].Attributes["name"]); Assert.Equal(person.Id.ToString(), result[0].Id); }