コード例 #1
0
 public void Constructor_should_use_ipfs_private_network()
 {
     using (var ipfs = new IpfsAdapter(_passwordManager, FileSystem, _logger))
     {
         ipfs.Options.Swarm.PrivateNetworkKey.Should().NotBeNull();
     }
 }
コード例 #2
0
 public void Constructor_should_read_seed_servers_addresses_from_peerSettings()
 {
     using (var ipfs = new IpfsAdapter(_passwordManager, FileSystem, _logger))
     {
         ipfs.Options.Discovery.BootstrapPeers.Count().Should().Be(8);
     }
 }
コード例 #3
0
 public void Constructor_should_use_ipfs_subfolder()
 {
     using (var ipfs = new IpfsAdapter(_passwordManager, FileSystem, _logger))
     {
         ipfs.Options.Repository.Folder.Should()
         .Be(Path.Combine(FileSystem.GetCatalystDataDir().FullName, Constants.DfsDataSubDir));
     }
 }
コード例 #4
0
        public DfsTests(ITestOutputHelper output) : base(output)
        {
            _hashProvider = new HashProvider(HashingAlgorithm.GetAlgorithmMetadata("blake2b-256"));

            _output = output;
            var passwordReader = Substitute.For <IPasswordManager>();

            passwordReader.RetrieveOrPromptAndAddPasswordToRegistry(Arg.Any <PasswordRegistryTypes>(), Arg.Any <string>())
            .Returns(TestPasswordReader.BuildSecureStringPassword("abcd"));

            _logger = Substitute.For <ILogger>();
            _ipfs   = new IpfsAdapter(passwordReader, FileSystem, _logger);

            // Starting IPFS takes a few seconds.  Do it here, so that individual
            // test times are not affected.
            _ipfs.Generic.IdAsync().Wait();
        }
コード例 #5
0
        public NodeFileTransferTests(ITestOutputHelper testOutput) : base(testOutput)
        {
            var hashProvider = new HashProvider(HashingAlgorithm.GetAlgorithmMetadata("blake2b-256"));

            _logger                  = Substitute.For <ILogger>();
            _fakeContext             = Substitute.For <IChannelHandlerContext>();
            _nodeFileTransferFactory = new DownloadFileTransferFactory(_logger);

            var passwordManager = Substitute.For <IPasswordManager>();

            passwordManager
            .RetrieveOrPromptAndAddPasswordToRegistry(PasswordRegistryTypes.IpfsPassword, Arg.Any <string>())
            .Returns(TestPasswordReader.BuildSecureStringPassword("abcd"));

            var ipfsEngine = new IpfsAdapter(passwordManager, FileSystem, _logger);

            _logger = Substitute.For <ILogger>();
            _dfs    = new Dfs(ipfsEngine, hashProvider, _logger);
        }