Ejemplo n.º 1
0
        public void Method_resolution_is_case_sensitive()
        {
            SingletonModulePool <INetRpcModule> pool = new(new NetRpcModule(LimboLogs.Instance, Substitute.For <INetBridge>()), true);

            _moduleProvider.Register(pool);

            _moduleProvider.Check("net_VeRsIoN", _context).Should().Be(ModuleResolution.Unknown);
            _moduleProvider.Check("net_Version", _context).Should().Be(ModuleResolution.Unknown);
            _moduleProvider.Check("Net_Version", _context).Should().Be(ModuleResolution.Unknown);
            _moduleProvider.Check("net_version", _context).Should().Be(ModuleResolution.Enabled);
        }
Ejemplo n.º 2
0
        public void Module_provider_will_recognize_disabled_modules()
        {
            JsonRpcConfig jsonRpcConfig = new JsonRpcConfig();

            jsonRpcConfig.EnabledModules = new string[0];
            _moduleProvider = new RpcModuleProvider(jsonRpcConfig, LimboLogs.Instance);
            _moduleProvider.Register(new SingletonModulePool <IProofModule>(Substitute.For <IProofModule>(), false));
            ModuleResolution resolution = _moduleProvider.Check("proof_call");

            Assert.AreEqual(ModuleResolution.Disabled, resolution);
        }
        public void With_filter_can_reject(string regex, ModuleResolution expectedResult)
        {
            JsonRpcConfig config = new JsonRpcConfig();

            _fileSystem.File.Exists(Arg.Any <string>()).Returns(true);
            _fileSystem.File.ReadLines(Arg.Any <string>()).Returns(new[] { regex });
            _moduleProvider = new RpcModuleProvider(_fileSystem, config, LimboLogs.Instance);

            SingletonModulePool <INetModule> pool = new SingletonModulePool <INetModule>(new NetModule(LimboLogs.Instance, Substitute.For <INetBridge>()), true);

            _moduleProvider.Register(pool);

            ModuleResolution resolution = _moduleProvider.Check("net_version");

            resolution.Should().Be(expectedResult);
        }
Ejemplo n.º 4
0
 public ModuleResolution Check(string methodName)
 {
     return(_provider.Check(methodName));
 }
 public ModuleResolution Check(string methodName, JsonRpcContext context)
 {
     return(_provider.Check(methodName, context));
 }
Ejemplo n.º 6
0
 public ModuleResolution Check(string methodName, RpcEndpoint rpcEndpoint)
 {
     return(_provider.Check(methodName, rpcEndpoint));
 }