Beispiel #1
0
        public void Can_Start_File_Download_On_Successful_Response()
        {
            var correlationId = SendResponseToHandler(FileTransferResponseCodeTypes.Successful);

            _fileDownloadFactory.GetFileTransferInformation(correlationId).Received(1).SetLength(ExpectedFileSize);
            _fileDownloadFactory.Received(1)?.FileTransferAsync(correlationId, CancellationToken.None);
        }
        public void CanHandlerDownloadChunk()
        {
            var guid    = CorrelationId.GenerateCorrelationId();
            var request = new TransferFileBytesRequest
            {
                ChunkBytes          = ByteString.Empty,
                ChunkId             = 1,
                CorrelationFileName = CorrelationId.GenerateCorrelationId().Id.ToByteString()
            }.ToProtocolMessage(PeerIdHelper.GetPeerId("Test"), guid);

            _downloadFileTransferFactory.DownloadChunk(Arg.Any <TransferFileBytesRequest>())
            .Returns(FileTransferResponseCodeTypes.Successful);

            request.SendToHandler(_context, _observer);
            _downloadFileTransferFactory.Received(1).DownloadChunk(Arg.Any <TransferFileBytesRequest>());
        }