Exemplo n.º 1
0
        public void Proof_module_is_registered_if_configured()
        {
            JsonRpcConfig jsonRpcConfig = new JsonRpcConfig();

            jsonRpcConfig.Enabled = true;

            IConfigProvider configProvider = Substitute.For <IConfigProvider>();

            configProvider.GetConfig <IJsonRpcConfig>().Returns(jsonRpcConfig);

            IRpcModuleProvider rpcModuleProvider = Substitute.For <IRpcModuleProvider>();

            EthereumRunnerContext context = Build.ContextWithMocks();

            context.ConfigProvider    = configProvider;
            context.RpcModuleProvider = rpcModuleProvider;
            context.Signer            = new Signer(ChainId.Mainnet, TestItem.PrivateKeyA, LimboLogs.Instance);
            context.KeyStore          = Substitute.For <IKeyStore>();

            RegisterRpcModules registerRpcModules = new RegisterRpcModules(context);

            registerRpcModules.Execute(CancellationToken.None);

            rpcModuleProvider.ReceivedWithAnyArgs().Register <IProofModule>(null);
        }
        public void Proof_module_is_registered_if_configured()
        {
            JsonRpcConfig jsonRpcConfig = new JsonRpcConfig();

            jsonRpcConfig.Enabled = true;

            IConfigProvider configProvider = Substitute.For <IConfigProvider>();

            configProvider.GetConfig <IJsonRpcConfig>().Returns(jsonRpcConfig);

            IRpcModuleProvider rpcModuleProvider = Substitute.For <IRpcModuleProvider>();

            NethermindApi context = Build.ContextWithMocks();

            context.ConfigProvider    = configProvider;
            context.RpcModuleProvider = rpcModuleProvider;
            var signer = new Signer(ChainId.Mainnet, TestItem.PrivateKeyA, LimboLogs.Instance);

            context.TxSender          = new NullTxSender();
            context.EngineSignerStore = signer;

            context.KeyStore                 = Substitute.For <IKeyStore>();
            context.SyncModeSelector         = Substitute.For <ISyncModeSelector>();
            context.ChainLevelInfoRepository = Substitute.For <IChainLevelInfoRepository>();

            RegisterRpcModules registerRpcModules = new RegisterRpcModules(context);

            registerRpcModules.Execute(CancellationToken.None);

            rpcModuleProvider.ReceivedWithAnyArgs().Register <IProofModule>(null);
        }
        public void Proof_module_is_registered_if_configured()
        {
            JsonRpcConfig jsonRpcConfig = new JsonRpcConfig();

            jsonRpcConfig.Enabled = true;

            IConfigProvider configProvider = Substitute.For <IConfigProvider>();

            configProvider.GetConfig <IJsonRpcConfig>().Returns(jsonRpcConfig);

            IRpcModuleProvider rpcModuleProvider = Substitute.For <IRpcModuleProvider>();

            EthereumRunnerContext context = Build.ContextWithMocks();

            context.ConfigProvider    = configProvider;
            context.RpcModuleProvider = rpcModuleProvider;

            RegisterRpcModules registerRpcModules = new RegisterRpcModules(context);

            registerRpcModules.Execute(CancellationToken.None);

            rpcModuleProvider.ReceivedWithAnyArgs().Register <IProofModule>(null);
        }