Ejemplo n.º 1
0
        public void TestCheckoutListTwoBooksSqLite()
        {
            //SETUP
            var showlog = false;
            var options = SqliteInMemory.CreateOptionsWithLogging <EfCoreContext>(log =>
            {
                if (showlog)
                {
                    _output.WriteLine(log.Message);
                }
            });

            using (var context = new EfCoreContext(options))
            {
                context.Database.EnsureCreated();
                context.SeedDatabaseFourBooks();

                var dbAccess = new PlaceOrderDbAccess(context);

                //ATTEMPT
                showlog = true;
                var booksDict = dbAccess.FindBooksByIdsWithPriceOffers(new [] { 1, 4 });

                //VERIFY
                booksDict.Count.ShouldEqual(2);
                booksDict[1].Promotion.ShouldBeNull();
                booksDict[4].Promotion.ShouldNotBeNull();
            }
        }
Ejemplo n.º 2
0
        public void TestCheckoutListTwoBooksSqLite()
        {
            //SETUP
            var inMemDb = new SqliteInMemory();

            using (var context = inMemDb.GetContextWithSetup())
            {
                context.SeedDatabaseFourBooks();
                context.SaveChanges();
                var dbAccess = new PlaceOrderDbAccess(context);

                //ATTEMPT
                var booksDict = dbAccess.FindBooksByIdsWithPriceOffers(new [] { 1, 4 });

                //VERIFY
                booksDict.Count.ShouldEqual(2);
                booksDict[1].Promotion.ShouldBeNull();
                booksDict[4].Promotion.ShouldNotBeNull();
            }
        }