public void UpdatePublicationDateDisconnected()
        {
            //SETUP
            ChangePubDateDto dto;
            var options = SqliteInMemory.CreateOptions <EfCoreContext>();

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

                var service = new ChangePubDateService(context);
                dto             = service.GetOriginal(4);
                dto.PublishedOn = new DateTime(2058, 1, 1);
            }
            using (var context = new EfCoreContext(options))
            {
                var service = new ChangePubDateService(context);

                //ATTEMPT
                service.UpdateBook(dto);

                //VERIFY
                var bookAgain = context.Books.Single(p => p.BookId == dto.BookId);
                bookAgain.PublishedOn.ShouldEqual(new DateTime(2058, 1, 1));
            }
        }
Exemple #2
0
        public IActionResult ChangePubDate(ChangePubDateDto dto)
        {
            Request.ThrowErrorIfNotLocal();

            var service = new ChangePubDateService(_context);

            service.UpdateBook(dto);
            SetupTraceInfo(); //REMOVE THIS FOR BOOK as it could be confusing
            return(View("BookUpdated", "Successfully changed publication date"));
        }