public void Setup() { options = new DbContextOptionsBuilder <FancyLibraryContext>() .UseInMemoryDatabase(databaseName: "fancy_library_find_country") .Options; db = new FancyLibraryContext(options); countryServices = new CountryServices(db); }
public void Setup() { options = new DbContextOptionsBuilder <FancyLibraryContext>() .UseInMemoryDatabase(databaseName: "fancy_library_get_author_books") .Options; db = new FancyLibraryContext(options); authorServices = new AuthorServices(db); }
public void Setup() { options = new DbContextOptionsBuilder <FancyLibraryContext>() .UseInMemoryDatabase(databaseName: "fancy_library") .Options; db = new FancyLibraryContext(options); userServices = new UserServices(db); users = CreateInMemoryDb(); }
public void Setup() { options = new DbContextOptionsBuilder <FancyLibraryContext>() .UseInMemoryDatabase(databaseName: "fancy_library_find_author") .Options; db = new FancyLibraryContext(options); authorServices = new AuthorServices(db); db.Authors.AddRange(CreateInMemoryDb()); db.SaveChanges(); }
public void Setup() { options = new DbContextOptionsBuilder <FancyLibraryContext>() .UseInMemoryDatabase(databaseName: "fancy_library_add_country") .Options; db = new FancyLibraryContext(options); countryServices = new CountryServices(db); db.Countries.AddRange(CreateInMemoryDb()); db.SaveChanges(); }
public void Setup() { options = new DbContextOptionsBuilder <FancyLibraryContext>() .UseInMemoryDatabase(databaseName: "fancy_library_get_all_books") .Options; db = new FancyLibraryContext(options); bookServices = new BookServices(db); db.Books.AddRange(CreateInMemoryDb()); db.SaveChanges(); }
public void Setup() { options = new DbContextOptionsBuilder <FancyLibraryContext>() .UseInMemoryDatabase(databaseName: "fancy_library_get_author_books_count") .Options; db = new FancyLibraryContext(options); authorServices = new AuthorServices(db); db.Authors.AddRange(FillAuthors()); db.Books.AddRange(FillBooks()); db.SaveChanges(); }
public void Setup() { options = new DbContextOptionsBuilder <FancyLibraryContext>() .UseInMemoryDatabase(databaseName: "fancy_library_get_user_data") .Options; db = new FancyLibraryContext(options); userServices = new UserServices(db); db.Users.AddRange(CreateInMemoryDb()); db.Contacts.AddRange(FillContacts()); db.SaveChanges(); }
public void Setup() { options = new DbContextOptionsBuilder <FancyLibraryContext>() .UseInMemoryDatabase(databaseName: "fancy_library_find_book_user") .Options; db = new FancyLibraryContext(options); userBookServices = new UserBookServices(db); db.Users.AddRange(FillUsers()); db.Books.AddRange(FillBooks()); db.UsersBooks.AddRange(FillUsersBooks()); db.SaveChanges(); }
public void Setup() { options = new DbContextOptionsBuilder <FancyLibraryContext>() .UseInMemoryDatabase(databaseName: "fancy_library_change") .Options; db = new FancyLibraryContext(options); userServices = new UserServices(db); users = CreateInMemoryDb(); db.Users.AddRange(users); db.SaveChanges(); user = db.Users.FirstOrDefault(); }
public void DoesMethodReturnZeroWhenUserHasZeroBooks() { options = new DbContextOptionsBuilder <FancyLibraryContext>() .UseInMemoryDatabase(databaseName: "fancy_library_books_count_zero") .Options; db = new FancyLibraryContext(options); services = new UserBookServices(db); db.Books.AddRange(FillBooks()); db.UsersBooks.AddRange(FillUsersBooks()); db.Users.AddRange(FillUsers()); db.SaveChanges(); User user = db.Users.Last(); Assert.That(0, Is.EqualTo(services.GetUserBooksCount(user))); }
public void IsFindingCorrectCountWhenUserHasMoreThanZeroBook() { options = new DbContextOptionsBuilder <FancyLibraryContext>() .UseInMemoryDatabase(databaseName: "fancy_library_books_count_four") .Options; db = new FancyLibraryContext(options); services = new UserBookServices(db); db.Books.AddRange(FillBooks()); db.UsersBooks.AddRange(FillUsersBooks()); db.Users.AddRange(FillUsers()); db.SaveChanges(); User user = db.Users.First(); Assert.That(4, Is.EqualTo(services.GetUserBooksCount(user))); }
public CountryServices(FancyLibraryContext db) { this.db = db; }
public void Setup() { db = new FancyLibraryContext(); userServices = new UserServices(db); }
public UserServices(FancyLibraryContext db) { this.db = db; }
public AuthorServices(FancyLibraryContext db) { this.db = db; }
public BookServices(FancyLibraryContext db) { this.db = db; }