public void GetPeerListResponse_Can_Be_Sent() { //Arrange var commandContext = TestCommandHelpers.GenerateCliRequestCommandContext(); var connectedNode = commandContext.GetConnectedNode(null); var command = new PeerListCommand(commandContext, Substitute.For <ILogger>()); //Act TestCommandHelpers.GenerateRequest(commandContext, command, "-n", "node1"); //Assert var requestSent = TestCommandHelpers.GetRequest <GetPeerListRequest>(connectedNode); requestSent.Should().BeOfType(typeof(GetPeerListRequest)); }
public void GetPeerListResponse_Can_Get_Output() { var getPeerListResponse = new GetPeerListResponse(); getPeerListResponse.Peers.Add(new PeerId()); var commandContext = TestCommandHelpers.GenerateCliResponseCommandContext(_testScheduler); var getPeerListCommand = new PeerListCommand(commandContext, Substitute.For <ILogger>()); //Act TestCommandHelpers.GenerateResponse(commandContext, getPeerListResponse); _testScheduler.Start(); commandContext.UserOutput.Received(1).WriteLine(getPeerListResponse.ToJsonString()); }