public void CompareWithBookDatabase()
        {
            //SETUP
            string connectionString;

            using (var context = new BookContext(GetBookContextOptions()))
            {
                connectionString = context.Database.GetDbConnection().ConnectionString;
                context.Database.EnsureCreated();
            }

            using (var context = new BookOrderContext(_options))
            {
                var comparer = new CompareEfSql();

                //ATTEMPT
                var hasErrors = comparer.CompareEfWithDb(connectionString, context);

                //VERIFY
                hasErrors.ShouldBeTrue();
                var errors = CompareLog.ListAllErrors(comparer.Logs).ToList();
                errors.Count.ShouldEqual(2);
                errors[0].ShouldEqual(
                    "NOT IN DATABASE: Entity 'LineItem', table name. Expected = LineItem");
                errors[1].ShouldEqual(
                    "NOT IN DATABASE: Entity 'Order', table name. Expected = Orders");
            }
        }
        public void CompareDatabaseViaConnectionName()
        {
            //SETUP
            const string connectionStringName = "BookOrderConnection"; //#A
            //!!!!!!!!!! LEAVE OUT OF BOOK - START
            var connectionString = AppSettings.GetConfiguration().GetConnectionString(connectionStringName);
            var optionsBuilder   = new DbContextOptionsBuilder <BookOrderContext>();

            optionsBuilder.UseSqlServer(connectionString);
            var options = optionsBuilder.Options;

            //!!!!!!!!!! LEAVE OUT OF BOOK - END
            //... I left out the option building part to save space
            using (var context = new BookOrderContext(options)) //#B
            {
                var comparer = new CompareEfSql();              //#C

                //ATTEMPT
                bool hasErrors = comparer.CompareEfWithDb             //#D
                                     (connectionStringName, context); //#D

                //VERIFY
                hasErrors.ShouldBeFalse(comparer.GetAllErrors); //#E
            }
        }
        public ComparerBooksAndOrders(ITestOutputHelper output)
        {
            _output  = output;
            _options = this
                       .CreateUniqueClassOptions <BookOrderContext>();

            using (var context = new BookOrderContext(_options))
            {
                _connectionString = context.Database.GetDbConnection().ConnectionString;
                context.Database.EnsureCreated();
            }
        }
        public void CompareViaConnection()
        {
            //SETUP
            using (var context = new BookOrderContext(_options))
            {
                var comparer = new CompareEfSql();

                //ATTEMPT
                var hasErrors = comparer.CompareEfWithDb(_connectionString, context);

                //VERIFY
                hasErrors.ShouldBeFalse(comparer.GetAllErrors);
            }
        }