示例#1
0
        public async Task send_should_fail_if_deposit_does_not_exist()
        {
            var receipt = GetDataDeliveryReceiptRequest();
            await _receiptService.SendAsync(receipt);

            await _depositProvider.Received().GetAsync(receipt.DepositId);

            _sessionService.DidNotReceive().GetActive(receipt.DepositId);
        }
        public async Task set_units_should_fail_for_missing_deposit()
        {
            var depositId = Keccak.Zero;
            var consumedUnitsFromProvider = 0u;
            var session = GetConsumerSession();

            _sessionService.GetActive(depositId).Returns(session);

            await _dataConsumerService.SetUnitsAsync(depositId, consumedUnitsFromProvider);

            _sessionService.Received(1).GetActive(depositId);
            await _depositProvider.Received(1).GetAsync(depositId);

            await _sessionRepository.DidNotReceiveWithAnyArgs().UpdateAsync(Arg.Any <ConsumerSession>());
        }
        public async Task send_data_request_should_fail_for_missing_deposit()
        {
            var depositId = Keccak.Zero;

            var result = await _dataRequestService.SendAsync(depositId);

            result.Should().Be(DataRequestResult.DepositNotFound);
            await _depositProvider.Received(1).GetAsync(depositId);
        }
示例#4
0
        public async Task disable_data_stream_should_fail_for_missing_deposit()
        {
            var depositId = Keccak.Zero;
            var client    = "test";
            var session   = GetConsumerSession();

            _sessionService.GetActive(depositId).Returns(session);
            _providerService.GetPeer(session.ProviderAddress).Returns(_providerPeer);

            var result = await _dataStreamService.DisableDataStreamAsync(depositId, client);

            result.Should().BeNull();
            _providerPeer.DidNotReceive().SendDisableDataStream(depositId, client);
            _sessionService.Received(1).GetActive(depositId);
            _providerService.Received(1).GetPeer(session.ProviderAddress);
            await _depositProvider.Received(1).GetAsync(session.DepositId);
        }