Exemplo n.º 1
0
        public void One_and_null()
        {
            DataAssetRuleDecoder.Init();
            DataAssetRules rules = new DataAssetRules(new DataAssetRule(1), null);

            DataAssetRulesDecoder decoder = new DataAssetRulesDecoder();

            decoder.Decode(decoder.Encode(rules).Bytes.AsRlpStream()).Should().BeEquivalentTo(rules);
        }
Exemplo 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();
 }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 private static void InitDecoders()
 {
     DataAssetDecoder.Init();
     DataAssetRulesDecoder.Init();
     DataAssetRuleDecoder.Init();
     DataAssetProviderDecoder.Init();
     DataDeliveryReceiptDecoder.Init();
     DataRequestDecoder.Init();
     EarlyRefundTicketDecoder.Init();
     FaucetResponseDecoder.Init();
     FaucetRequestDetailsDecoder.Init();
     DataDeliveryReceiptDecoder.Init();
     DataDeliveryReceiptRequestDecoder.Init();
     UnitsRangeDecoder.Init();
     SessionDecoder.Init();
     DepositApprovalDecoder.Init();
     DataDeliveryReceiptToMergeDecoder.Init();
 }
Exemplo n.º 5
0
        public MessageTests()
        {
            _service.Register(typeof(HiMessage).Assembly);

            DataAssetDecoder.Init();
            DataAssetRulesDecoder.Init();
            DataAssetRuleDecoder.Init();
            DataAssetProviderDecoder.Init();
            DataDeliveryReceiptDecoder.Init();
            DataRequestDecoder.Init();
            EarlyRefundTicketDecoder.Init();
            FaucetResponseDecoder.Init();
            FaucetRequestDetailsDecoder.Init();
            DataDeliveryReceiptDecoder.Init();
            DataDeliveryReceiptRequestDecoder.Init();
            UnitsRangeDecoder.Init();
            SessionDecoder.Init();
            DepositApprovalDecoder.Init();
            DataDeliveryReceiptToMergeDecoder.Init();
        }
Exemplo n.º 6
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));
            }
        }