Ejemplo n.º 1
0
 private void OnUpdateFitnessSuccess(EmptyDto _)
 {
     Destroy(gameObject);
 }
        public void AddsPresetTransactionRelatedFields()
        {
            var searchIndex = new FunctionIndexDefinition <EmptyDto>(
                addPresetTransactionFields: true);

            var dto = new EmptyDto();

            var presetFields = searchIndex
                               .Fields
                               .Where(f => f.IsPresetSearchField()).ToArray();

            Assert.Equal(13, presetFields.Length);

            var transactionWithReceipt = CreateDummyTransaction();
            var tx = transactionWithReceipt.Transaction;

            searchIndex
            .Assertions(dto, transactionWithReceipt)
            .HasField(PresetSearchFieldName.tx_uid, f =>
                      f.IsString()
                      .HasFlags(isKey: true, isSortable: true, isSearchable: true)
                      .ReturnsValue("1_1"))
            .HasField(PresetSearchFieldName.tx_hash, f =>
                      f.IsString()
                      .HasFlags(isSortable: true, isSearchable: true, isFilterable: true)
                      .ReturnsValue(tx.TransactionHash))
            .HasField(PresetSearchFieldName.tx_index, f =>
                      f.IsHexBigInteger()
                      .HasFlags(isSortable: true)
                      .ReturnsValue(tx.TransactionIndex))
            .HasField(PresetSearchFieldName.tx_block_hash, f =>
                      f.IsString()
                      .HasFlags()
                      .ReturnsValue(tx.BlockHash))
            .HasField(PresetSearchFieldName.tx_block_number, f =>
                      f.IsHexBigInteger()
                      .HasFlags(isSortable: true, isSearchable: true, isFilterable: true, isFacetable: true)
                      .ReturnsValue(tx.BlockNumber))
            .HasField(PresetSearchFieldName.tx_block_timestamp, f =>
                      f.IsHexBigInteger()
                      .HasFlags(isSortable: true)
                      .ReturnsValue(transactionWithReceipt.BlockTimestamp))
            .HasField(PresetSearchFieldName.tx_value, f =>
                      f.IsHexBigInteger()
                      .HasFlags(isSortable: true)
                      .ReturnsValue(tx.Value))
            .HasField(PresetSearchFieldName.tx_from, f =>
                      f.IsString()
                      .HasFlags(isSortable: true, isSearchable: true, isFilterable: true, isFacetable: true)
                      .ReturnsValue(tx.From))
            .HasField(PresetSearchFieldName.tx_to, f =>
                      f.IsString()
                      .HasFlags(isSortable: true, isSearchable: true, isFilterable: true, isFacetable: true)
                      .ReturnsValue(tx.To))
            .HasField(PresetSearchFieldName.tx_gas, f =>
                      f.IsHexBigInteger()
                      .HasFlags(isSortable: true)
                      .ReturnsValue(tx.Gas))
            .HasField(PresetSearchFieldName.tx_gas_price, f =>
                      f.IsHexBigInteger()
                      .HasFlags(isSortable: true)
                      .ReturnsValue(tx.GasPrice))
            .HasField(PresetSearchFieldName.tx_input, f =>
                      f.IsString()
                      .HasFlags()
                      .ReturnsValue(tx.Input))
            .HasField(PresetSearchFieldName.tx_nonce, f =>
                      f.IsHexBigInteger()
                      .HasFlags(isSortable: true, isSearchable: true, isFilterable: true)
                      .ReturnsValue(tx.Nonce));
        }