public void SetUp()
        {
            PaymentClaimDecoder.Init();
            UnitsRangeDecoder.Init();
            TransactionInfoDecoder.Init();

            var memDb = new MemDb();

            repository = new PaymentClaimRocksRepository(memDb, new PaymentClaimDecoder());
        }
Esempio n. 2
0
 private void InitDecoders()
 {
     //initialize static constructors of needed decoders
     DataAssetDecoder.Init();
     UnitsRangeDecoder.Init();
     TransactionInfoDecoder.Init();
     DataAssetRulesDecoder.Init();
     DataAssetRuleDecoder.Init();
     DataRequestDecoder.Init();
     DataAssetProviderDecoder.Init();
 }
        public void Roundtrip(DepositDetails item)
        {
            DepositDecoder.Init();
            TransactionInfoDecoder.Init();
            DataAssetDecoder.Init();
            DataAssetRuleDecoder.Init();
            DataAssetRulesDecoder.Init();
            DataAssetProviderDecoder.Init();
            EarlyRefundTicketDecoder.Init();

            DepositDetailsDecoder decoder = new DepositDetailsDecoder();

            decoder.Decode(decoder.Encode(item).Bytes.AsRlpStream()).Should().BeEquivalentTo(item);
        }
Esempio n. 4
0
 private static void AddDecoders()
 {
     DataDeliveryReceiptDecoder.Init();
     DataDeliveryReceiptRequestDecoder.Init();
     DataDeliveryReceiptToMergeDecoder.Init();
     DataDeliveryReceiptDetailsDecoder.Init();
     DataAssetDecoder.Init();
     DataAssetRuleDecoder.Init();
     DataAssetRulesDecoder.Init();
     DataAssetProviderDecoder.Init();
     DataRequestDecoder.Init();
     DepositDecoder.Init();
     DepositApprovalDecoder.Init();
     EarlyRefundTicketDecoder.Init();
     EthRequestDecoder.Init();
     FaucetResponseDecoder.Init();
     FaucetRequestDetailsDecoder.Init();
     SessionDecoder.Init();
     TransactionInfoDecoder.Init();
     UnitsRangeDecoder.Init();
 }
Esempio n. 5
0
        static DepositDetailsRocksRepositoryTests()
        {
            if (_cases == null)
            {
                DepositDecoder.Init();
                TransactionInfoDecoder.Init();
                DataAssetDecoder.Init();
                DataAssetRuleDecoder.Init();
                DataAssetRulesDecoder.Init();
                DataAssetProviderDecoder.Init();
                EarlyRefundTicketDecoder.Init();

                Deposit           deposit   = new Deposit(TestItem.KeccakA, 100, 100, 100);
                DataAssetProvider provider  = new DataAssetProvider(TestItem.AddressA, "provider");
                DataAsset         dataAsset = new DataAsset(TestItem.KeccakA, "data_asset", "desc", 1, DataAssetUnitType.Time, 1000, 10000, new DataAssetRules(new DataAssetRule(1), null), provider, null, QueryType.Stream, DataAssetState.Published, null, false, null);
                DepositDetails    details   = new DepositDetails(
                    deposit,
                    dataAsset,
                    TestItem.AddressA,
                    Array.Empty <byte>(),
                    10,
                    Array.Empty <TransactionInfo>(),
                    9,
                    false,
                    false,
                    null,
                    Array.Empty <TransactionInfo>(),
                    false,
                    false,
                    null,
                    0,
                    6);
                _cases = new List <DepositDetails>();
                _cases.Add(details);

                _cases.Add(new DepositDetails(
                               deposit,
                               dataAsset,
                               TestItem.AddressA,
                               Array.Empty <byte>(),
                               10,
                               Array.Empty <TransactionInfo>(),
                               9,
                               false,
                               false,
                               null,
                               Array.Empty <TransactionInfo>(),
                               false,
                               false,
                               null,
                               0,
                               6));

                _cases.Add(new DepositDetails(
                               deposit,
                               dataAsset,
                               TestItem.AddressA,
                               Array.Empty <byte>(),
                               10,
                               Array.Empty <TransactionInfo>(),
                               9,
                               false,
                               false,
                               null,
                               Array.Empty <TransactionInfo>(),
                               false,
                               false,
                               null,
                               0,
                               6));
            }
        }