コード例 #1
0
ファイル: TorSharpProxy.cs プロジェクト: jphofmann/TorSharp
        private async Task <Tool> ConfigureAndStartAsync(Tool tool, IConfigurationDictionary configurationDictionary)
        {
            var configurer = new LineByLineConfigurer(configurationDictionary, new ConfigurationFormat());
            await configurer.ApplySettings(tool.ConfigurationPath, _settings).ConfigureAwait(false);

            await _toolRunner.StartAsync(tool).ConfigureAwait(false);

            return(tool);
        }
コード例 #2
0
        public async Task HashedControlPasswordGetsCleared()
        {
            // Arrange
            var format     = new ConfigurationFormat();
            var configurer = new LineByLineConfigurer(Target, format);
            var settings   = Environment.BuildSettings();

            settings.TorSettings.HashedControlPassword = "******";
            await configurer.ApplySettings(Tool, settings);

            var configurationBefore = File.ReadAllText(Tool.ConfigurationPath);

            // Act
            settings.TorSettings.HashedControlPassword = null;
            await configurer.ApplySettings(Tool, settings);

            // Assert
            var configurationAfter = File.ReadAllText(Tool.ConfigurationPath);

            Assert.Contains("HashedControlPassword NOT_A_REAL_HASH", configurationBefore);
            Assert.DoesNotContain("HashedControlPassword", configurationAfter);
        }