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

            db = new FancyLibraryContext(options);

            countryServices = new CountryServices(db);
        }
예제 #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);
        }
예제 #3
0
        public void Setup()
        {
            options = new DbContextOptionsBuilder <FancyLibraryContext>()
                      .UseInMemoryDatabase(databaseName: "fancy_library")
                      .Options;

            db = new FancyLibraryContext(options);

            userServices = new UserServices(db);

            users = CreateInMemoryDb();
        }
예제 #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();
        }
예제 #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();
        }
예제 #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();
        }
예제 #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();
        }
예제 #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();
        }
예제 #10
0
        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();
        }
예제 #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)));
        }
예제 #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)));
        }
예제 #13
0
 public CountryServices(FancyLibraryContext db)
 {
     this.db = db;
 }
예제 #14
0
 public void Setup()
 {
     db           = new FancyLibraryContext();
     userServices = new UserServices(db);
 }
예제 #15
0
 public UserServices(FancyLibraryContext db)
 {
     this.db = db;
 }
예제 #16
0
 public AuthorServices(FancyLibraryContext db)
 {
     this.db = db;
 }
예제 #17
0
 public BookServices(FancyLibraryContext db)
 {
     this.db = db;
 }