public void AttachNewItem_NullCollection_CreatesCollection() { var author = new Author { Books = null }; NavigationCollectionRepository <Author, ICollection <Book>, Book> repo = GetBooksNavRepo(author); var book = repo.CreateAndAttachItem(); Assert.NotNull(author.Books); Assert.Contains(book, author.Books); }
public void AttachNewItem_EmptyCollection_AddsItem() { var books = new List <Book>(); var author = new Author { Books = books }; NavigationCollectionRepository <Author, ICollection <Book>, Book> repo = GetBooksNavRepo(author); var book = repo.CreateAndAttachItem(); Assert.Contains(book, books); }