Example #1
0
        public void TestRemovePromotionBookOk()
        {
            //SETUP
            var options = SqliteInMemory.CreateOptions <EfCoreContext>();

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

            using (var context = new EfCoreContext(options))
            {
                var service = new AddRemovePromotionService(context);
                var dto     = service.GetOriginal(1);
                dto.ActualPrice     = dto.OrgPrice / 2;
                dto.PromotionalText = "";
                service.AddPromotion(dto);

                //ATTEMPT
                var book = service.RemovePromotion(dto.BookId);

                //VERIFY
                book.ActualPrice.ShouldEqual(dto.OrgPrice);
            }
        }