コード例 #1
0
 /// <summary>Initializes a new instance of the <see cref="TransferFileBytesRequestObserver"/> class.</summary>
 /// <param name="fileTransferFactory">The download transfer factory.</param>
 /// <param name="peerSettings"></param>
 /// <param name="logger">The logger.</param>
 public TransferFileBytesRequestObserver(IDownloadFileTransferFactory fileTransferFactory,
                                         IPeerSettings peerSettings,
                                         ILogger logger)
     : base(logger, peerSettings)
 {
     _fileTransferFactory = fileTransferFactory;
 }
コード例 #2
0
 public GetFileFromDfsResponseObserverTests()
 {
     _logger              = Substitute.For <ILogger>();
     _fakeContext         = Substitute.For <IChannelHandlerContext>();
     _fileDownloadFactory = Substitute.For <IDownloadFileTransferFactory>();
     _logger              = Substitute.For <ILogger>();
 }
コード例 #3
0
 public void Init()
 {
     _logger              = Substitute.For <ILogger>();
     _fakeContext         = Substitute.For <IChannelHandlerContext>();
     _fileDownloadFactory = Substitute.For <IDownloadFileTransferFactory>();
     _logger              = Substitute.For <ILogger>();
 }
コード例 #4
0
 /// <summary>Initializes a new instance of the <see cref="AddFileToDfsRequestObserver"/> class.</summary>
 /// <param name="dfs">The DFS.</param>
 /// <param name="peerSettings"></param>
 /// <param name="fileTransferFactory">The download file transfer factory.</param>
 /// <param name="logger">The logger.</param>
 public AddFileToDfsRequestObserver(IDfs dfs,
                                    IPeerSettings peerSettings,
                                    IDownloadFileTransferFactory fileTransferFactory,
                                    ILogger logger) : base(logger, peerSettings)
 {
     _fileTransferFactory = fileTransferFactory;
     _dfs = dfs;
 }
コード例 #5
0
 public GetFileFromDfsObserverHandlerTests(ITestOutputHelper testOutput) : base(testOutput)
 {
     _hashProvider        = new HashProvider(HashingAlgorithm.GetAlgorithmMetadata("blake2b-256"));
     _logger              = Substitute.For <ILogger>();
     _fakeContext         = Substitute.For <IChannelHandlerContext>();
     _fileDownloadFactory = new DownloadFileTransferFactory(_logger);
     _logger              = Substitute.For <ILogger>();
     _dfs = Substitute.For <IDfs>();
 }
コード例 #6
0
 /// <summary>Initializes a new instance of the <see cref="AddFileToDfsRequestObserver" /> class.</summary>
 /// <param name="dfsService">The DFS.</param>
 /// <param name="peerSettings"></param>
 /// <param name="fileTransferFactory">The download file transfer factory.</param>
 /// <param name="hashProvider"></param>
 /// <param name="logger">The logger.</param>
 public AddFileToDfsRequestObserver(IDfsService dfsService,
                                    IPeerSettings peerSettings,
                                    IDownloadFileTransferFactory fileTransferFactory,
                                    IHashProvider hashProvider,
                                    ILogger logger) : base(logger, peerSettings)
 {
     _fileTransferFactory = fileTransferFactory;
     _dfsService          = dfsService;
     _hashProvider        = hashProvider;
 }
コード例 #7
0
        public TransferFileBytesRequestObserverTests()
        {
            _context = Substitute.For <IChannelHandlerContext>();
            _context.Channel.Returns(Substitute.For <IChannel>());
            _downloadFileTransferFactory = Substitute.For <IDownloadFileTransferFactory>();
            var peerSettings = PeerIdHelper.GetPeerId("Test").ToSubstitutedPeerSettings();

            _observer = new TransferFileBytesRequestObserver(_downloadFileTransferFactory,
                                                             peerSettings,
                                                             Substitute.For <ILogger>());
        }
コード例 #8
0
        public void Init()
        {
            Setup(TestContext.CurrentContext);

            _hashProvider        = new HashProvider(HashingAlgorithm.GetAlgorithmMetadata("keccak-256"));
            _logger              = Substitute.For <ILogger>();
            _fakeContext         = Substitute.For <IChannelHandlerContext>();
            _fileDownloadFactory = new DownloadFileTransferFactory(_logger);
            _logger              = Substitute.For <ILogger>();
            _dfsService          = Substitute.For <IDfsService>();
        }
コード例 #9
0
        public AddFileToDfsRequestObserverTests()
        {
            _hashProvider     = new HashProvider(HashingAlgorithm.GetAlgorithmMetadata("blake2b-256"));
            _manualResetEvent = new ManualResetEvent(false);
            _senderIdentifier = PeerIdHelper.GetPeerId("sender");
            var peerSettings = _senderIdentifier.ToSubstitutedPeerSettings();

            _fakeDfs = Substitute.For <IDfs>();
            var logger = Substitute.For <ILogger>();

            _fakeContext                 = Substitute.For <IChannelHandlerContext>();
            _nodeFileTransferFactory     = Substitute.For <IDownloadFileTransferFactory>();
            _addFileToDfsRequestObserver = new AddFileToDfsRequestObserver(_fakeDfs,
                                                                           peerSettings,
                                                                           _nodeFileTransferFactory,
                                                                           logger);
        }
コード例 #10
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);
        }
コード例 #11
0
 /// <summary>Initializes a new instance of the <see cref="TransferFileBytesResponseObserver"/> class.</summary>
 /// <param name="fileTransferFactory">The download transfer factory.</param>
 /// <param name="logger">The logger.</param>
 public TransferFileBytesResponseObserver(IDownloadFileTransferFactory fileTransferFactory,
                                          ILogger logger)
     : base(logger, false)
 {
     _fileTransferFactory = fileTransferFactory;
 }
コード例 #12
0
 public DownloadFileTransferFactoryTests()
 {
     _downloadFileTransferFactory = new DownloadFileTransferFactory(Substitute.For <ILogger>());
 }
コード例 #13
0
ファイル: GetFileCommand.cs プロジェクト: umlspec/Catalyst
 public GetFileCommand(IDownloadFileTransferFactory downloadFileTransferFactory,
                       ICommandContext commandContext,
                       ILogger logger) : base(commandContext, logger)
 {
     _downloadFileTransferFactory = downloadFileTransferFactory;
 }
コード例 #14
0
 /// <summary>Initializes a new instance of the <see cref="GetFileFromDfsResponseObserver"/> class.</summary>
 /// <param name="logger">The logger.</param>
 /// <param name="fileTransferFactory">The file transfer.</param>
 public GetFileFromDfsResponseObserver(ILogger logger,
                                       IDownloadFileTransferFactory fileTransferFactory) : base(logger)
 {
     _fileTransferFactory = fileTransferFactory;
 }