public void Setup()
        {
            options = new DbContextOptionsBuilder <FancyLibraryContext>()
                      .UseInMemoryDatabase(databaseName: "fancy_library_find_country")
                      .Options;

            db = new FancyLibraryContext(options);

            countryServices = new CountryServices(db);
        }
Esempio n. 2
0
        public void Setup()
        {
            options = new DbContextOptionsBuilder <FancyLibraryContext>()
                      .UseInMemoryDatabase(databaseName: "fancy_library_get_author_books")
                      .Options;

            db = new FancyLibraryContext(options);

            authorServices = new AuthorServices(db);
        }
Esempio n. 3
0
        public void Setup()
        {
            options = new DbContextOptionsBuilder <FancyLibraryContext>()
                      .UseInMemoryDatabase(databaseName: "fancy_library")
                      .Options;

            db = new FancyLibraryContext(options);

            userServices = new UserServices(db);

            users = CreateInMemoryDb();
        }
Esempio n. 4
0
        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();
        }
Esempio n. 5
0
        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();
        }
Esempio n. 6
0
        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();
        }
Esempio n. 8
0
        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();
        }
Esempio n. 9
0
        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();
        }
Esempio n. 11
0
        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)));
        }
Esempio n. 12
0
        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)));
        }
Esempio n. 13
0
 public CountryServices(FancyLibraryContext db)
 {
     this.db = db;
 }
Esempio n. 14
0
 public void Setup()
 {
     db           = new FancyLibraryContext();
     userServices = new UserServices(db);
 }
Esempio n. 15
0
 public UserServices(FancyLibraryContext db)
 {
     this.db = db;
 }
Esempio n. 16
0
 public AuthorServices(FancyLibraryContext db)
 {
     this.db = db;
 }
Esempio n. 17
0
 public BookServices(FancyLibraryContext db)
 {
     this.db = db;
 }