Example #1
0
        public void RemovePeerResponse_Can_Get_Output()
        {
            //Arrange
            var removePeerResponse = new RemovePeerResponse();
            var commandContext     = TestCommandHelpers.GenerateCliResponseCommandContext(_testScheduler);
            var removePeerCommand  = new PeerRemoveCommand(commandContext, Substitute.For <ILogger>());

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

            _testScheduler.Start();

            //Assert
            commandContext.UserOutput.Received(1).WriteLine(removePeerResponse.ToJsonString());
        }
Example #2
0
        public void RemovePeerRequest_Can_Be_Sent()
        {
            //Arrange
            var commandContext = TestCommandHelpers.GenerateCliRequestCommandContext();
            var connectedNode  = commandContext.GetConnectedNode(null);
            var command        = new PeerRemoveCommand(commandContext, Substitute.For <ILogger>());

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

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

            requestSent.Should().BeOfType(typeof(RemovePeerRequest));
        }