public void GetPeerInfoRequest_Can_Be_Sent() { //Arrange var commandContext = TestCommandHelpers.GenerateCliRequestCommandContext(); var connectedNode = commandContext.GetConnectedNode(null); var command = new GetPeerInfoCommand(commandContext, Substitute.For <ILogger>()); //Act TestCommandHelpers.GenerateRequest(commandContext, command, "-n", "node1", "-i", "10.1.1.1", "-p", "publickey"); //Assert var requestSent = TestCommandHelpers.GetRequest <GetPeerInfoRequest>(connectedNode); requestSent.Should().BeOfType(typeof(GetPeerInfoRequest)); }
public void GetPeerInfoResponse_Can_Get_Output() { //Arrange var peer = new PeerInfo(); var getPeerInfoResponse = new GetPeerInfoResponse(); getPeerInfoResponse.PeerInfo.Add(peer); var commandContext = TestCommandHelpers.GenerateCliResponseCommandContext(_testScheduler); var getPeerInfoCommand = new GetPeerInfoCommand(commandContext, Substitute.For <ILogger>()); //Act TestCommandHelpers.GenerateResponse(commandContext, getPeerInfoResponse); _testScheduler.Start(); //Assert commandContext.UserOutput.Received(1).WriteLine(getPeerInfoResponse.ToJsonString()); }