Пример #1
0
        protected BlockRepositoryTests(IDbContextFactory <DbContext> db)
        {
            try
            {
                this.network = Networks.Default.Mainnet;
                this.db      = db;

                this.subject = new BlockRepository(
                    this.network,
                    this.db,
                    new TransactionSerializer(
                        new ITransactionPayloadSerializer[]
                {
                    new CreateManagedPropertySerializer(),
                    new SimpleSendSerializer(),
                }));

                using (var context = db.CreateAsync().AsTask().Result)
                {
                    context.Database.EnsureCreated();
                }
            }
            catch
            {
                if (db is IDisposable d)
                {
                    d.Dispose();
                }
                throw;
            }
        }