Пример #1
0
        private static async Task CompareCollection <T>(IConsensusDataSource <IEnumerable <T> > source1,
                                                        IConsensusDataSource <IEnumerable <T> > source2,
                                                        bool compareJson,
                                                        Func <EquivalencyAssertionOptions <T>, EquivalencyAssertionOptions <T> > options = null)
        {
            if (compareJson)
            {
                JToken data        = JsonHelper.ParseNormalize(await source1.GetJsonData());
                JToken expectation = JsonHelper.ParseNormalize(await source2.GetJsonData());
                data.Should().BeEquivalentTo(expectation);
                data["error"].Should().BeNull(data["error"]?.ToString());
            }
            else
            {
                string dataJson = string.Empty, expectationJson = string.Empty;
                try
                {
                    IEnumerable <T> data, expectation;
                    (data, dataJson) = await source1.GetData();

                    (expectation, expectationJson) = await source2.GetData();

                    data.Should().BeEquivalentTo(expectation, options ?? (o => o));
                }
                finally
                {
                    await WriteOutJson(dataJson, expectationJson);
                }
            }
        }
Пример #2
0
 public async Task CompareReceipt(Uri uri1, Uri uri2, Keccak blockHash = null)
 {
     using IConsensusDataSource <ReceiptForRpc> receipt1Source = GetSource <ReceiptForRpc>(uri1);
     using IConsensusDataSource <ReceiptForRpc> receipt2Source = GetSource <ReceiptForRpc>(uri2);
     TrySetData(blockHash, receipt1Source, receipt2Source);
     await Compare(receipt1Source, receipt2Source, false, ReceiptOptions);
 }
Пример #3
0
 public async Task CompareParityBlockTrace(Uri uri1, Uri uri2, long blockNumber)
 {
     using IConsensusDataSource <IEnumerable <ParityTxTraceFromStore> > receipt1Source = GetSource <IEnumerable <ParityTxTraceFromStore> >(uri1, TraceModuleFactory.Converters);
     using IConsensusDataSource <IEnumerable <ParityTxTraceFromStore> > receipt2Source = GetSource <IEnumerable <ParityTxTraceFromStore> >(uri2, TraceModuleFactory.Converters);
     TrySetData(blockNumber, receipt1Source, receipt2Source);
     await CompareCollection(receipt1Source, receipt2Source, true);
 }
Пример #4
0
 public async Task CompareGethTxTrace(Uri uri1, Uri uri2, Keccak transactionHash = null, GethTraceOptions gethTraceOptions = null)
 {
     gethTraceOptions ??= GethTraceOptions.Default;
     using IConsensusDataSource <GethLikeTxTrace> receipt1Source = GetSource <GethLikeTxTrace>(uri1, DebugModuleFactory.Converters);
     using IConsensusDataSource <GethLikeTxTrace> receipt2Source = GetSource <GethLikeTxTrace>(uri2, DebugModuleFactory.Converters);
     TrySetData(transactionHash, receipt1Source, receipt2Source);
     TrySetData(gethTraceOptions, receipt1Source, receipt2Source);
     await Compare(receipt1Source, receipt2Source, true);
 }
Пример #5
0
 public async Task CompareGethBlockTrace(Uri uri1, Uri uri2, Keccak blockHash = null, GethTraceOptions gethTraceOptions = null)
 {
     gethTraceOptions ??= GethTraceOptions.Default;
     using IConsensusDataSource <IEnumerable <GethLikeTxTrace> > receipt1Source = GetSource <IEnumerable <GethLikeTxTrace> >(uri1, DebugModuleFactory.Converters);
     using IConsensusDataSource <IEnumerable <GethLikeTxTrace> > receipt2Source = GetSource <IEnumerable <GethLikeTxTrace> >(uri2, DebugModuleFactory.Converters);
     TrySetData(blockHash, receipt1Source, receipt2Source);
     TrySetData(gethTraceOptions, receipt1Source, receipt2Source);
     await CompareCollection(receipt1Source, receipt2Source, true);
 }