public async Task AddAuthorAsync_Test() { using (var context = new LibraryContext(Utilities.TestDbContextOptions())) using (ILibraryRepository repository = new LibraryRepository(context)) { await repository.AddAuthorAsync(new Author { FirstName = "Jens", LastName = "Lapidus", Genre = "Thriller", DateOfBirth = new DateTimeOffset(new DateTime(1974, 5, 24)), Books = new List <Book> { new Book { Title = "Easy Money", Description = "Easy Money or Snabba cash is a novel from 2006 by Jens Lapidus" } } }); await repository.SaveChangesAsync(); var authors = await repository.GetAuthorsAsync(); var author = authors.ElementAt(0); Assert.True(authors.Count() == 1); Assert.NotEqual(Guid.Empty, author.Id); Assert.Equal("Jens", author.FirstName); Assert.Equal("Lapidus", author.LastName); Assert.Equal("Thriller", author.Genre); Assert.Equal(new DateTimeOffset(new DateTime(1974, 5, 24)), author.DateOfBirth); var books = author.Books; var book = books.ElementAt(0); Assert.True(books.Count() == 1); Assert.NotEqual(Guid.Empty, book.Id); Assert.Equal("Easy Money", book.Title); Assert.Equal("Easy Money or Snabba cash is a novel from 2006 by Jens Lapidus", book.Description); } }