public void can_add_consumer() { testConsumer = TestConsumer.ForDeposit(Keccak.Zero) .WithNode(1).AddSession().WithUnpaidUnits(10) .And.Build(); ConsumerNode consumerNode = testConsumer.Node(1).Node; INdmProviderPeer consumerPeer = consumerNode.Peer; ConsumerNode[] pre = sessionManager.GetConsumerNodes().ToArray(); bool consumerAlreadyAdded = pre.Contains(consumerNode); Assert.IsTrue(!consumerAlreadyAdded); providerService.AddConsumerPeer(consumerPeer); var addedConsumer = sessionManager.GetConsumerNodes().Where(node => node.Peer.Equals(consumerPeer)); Assert.IsTrue(addedConsumer != null); }
public async Task will_send_early_refund_ticket() { testConsumer = TestConsumer.ForDeposit(Keccak.Zero) .WithNode(1).AddSession().WithUnpaidUnits(10) .And.Build(); await consumerRepository.AddAsync(testConsumer.Consumer); var consumerNode = testConsumer.Node(1).Node; sessionManager.AddPeer(consumerNode.Peer); sessionManager.SetSession(consumerNode.Sessions.First(), consumerNode.Peer); refundPolicy.GetClaimableAfterUnits(testConsumer.DepositId).Returns((uint)1); var depositId = await providerService.SendEarlyRefundTicketAsync(testConsumer.DepositId); consumerNode.Peer.Received().SendEarlyRefundTicket(Arg.Any <EarlyRefundTicket>(), RefundReason.DataDiscontinued); Assert.IsNotNull(depositId); }