Пример #1
0
        public async Task database_path_should_be_base_db_and_ndm_db_path()
        {
            _initConfig.BaseDbPath  = "db";
            _ndmConfig.DatabasePath = "ndm";
            INethermindApi nethermindApi  = Substitute.For <INethermindApi>();
            var            configProvider = Substitute.For <IConfigProvider>();

            configProvider.GetConfig <INdmConfig>().Returns(_ndmConfig);
            configProvider.GetConfig <IInitConfig>().Returns(_initConfig);
            nethermindApi.ConfigProvider.Returns(configProvider);

            INdmApi ndmApi = new NdmApi(nethermindApi);

            ndmApi.AccountService = Substitute.For <IAccountService>();
            await _ndmInitializer.InitAsync(ndmApi);

            _ndmInitializer.DbPath.Should().Be(Path.Combine(_initConfig.BaseDbPath, _ndmConfig.DatabasePath));
        }
        public async Task database_path_should_be_base_db_and_ndm_db_path()
        {
            _initConfig.BaseDbPath  = "db";
            _ndmConfig.DatabasePath = "ndm";
            INethermindApi nethermindApi  = Substitute.For <INethermindApi>();
            var            configProvider = Substitute.For <IConfigProvider>();

            configProvider.GetConfig <INdmConfig>().Returns(_ndmConfig);
            configProvider.GetConfig <IInitConfig>().Returns(_initConfig);
            nethermindApi.ConfigProvider.Returns(configProvider);

            INdmApi ndmApi = new NdmApi(nethermindApi);

            ndmApi.ConsumerService           = Substitute.For <IConsumerService>();
            ndmApi.AccountService            = Substitute.For <IAccountService>();
            ndmApi.NdmConsumerChannelManager = Substitute.For <INdmConsumerChannelManager>();
            ndmApi.Enode = new Enode(TestItem.PublicKeyA, IPAddress.Any, 30303);

            await _ndmInitializer.InitAsync(ndmApi);

            _ndmInitializer.DbPath.Should().Be(Path.Combine(_initConfig.BaseDbPath, _ndmConfig.DatabasePath));
        }