public void GetPeerReputation_Can_Be_Sent()
        {
            //Arrange
            var commandContext = TestCommandHelpers.GenerateCliRequestCommandContext();
            var connectedNode  = commandContext.GetConnectedNode(null);
            var command        = new PeerReputationCommand(commandContext, Substitute.For <ILogger>());

            //Act
            TestCommandHelpers.GenerateRequest(commandContext, command, "-n", "node1", "-i", "10.1.1.1", "-p",
                                               "public key");

            //Assert
            var requestSent = TestCommandHelpers.GetRequest <GetPeerReputationRequest>(connectedNode);

            requestSent.Should().BeOfType(typeof(GetPeerReputationRequest));
        }
예제 #2
0
        public void GetPeerReputationResponse_Can_Get_Output()
        {
            //Arrange
            var getPeerReputationResponse = new GetPeerReputationResponse {
                Reputation = 100
            };
            var commandContext           = TestCommandHelpers.GenerateCliResponseCommandContext(_testScheduler);
            var getPeerReputationCommand = new PeerReputationCommand(commandContext, Substitute.For <ILogger>());

            //Act
            TestCommandHelpers.GenerateResponse(commandContext, getPeerReputationResponse);

            _testScheduler.Start();

            //Assert
            commandContext.UserOutput.Received(1).WriteLine(getPeerReputationResponse.ToJsonString());
        }