コード例 #1
0
        public void SignMessageRequest_Can_Be_Sent()
        {
            //Arrange
            var commandContext = TestCommandHelpers.GenerateCliRequestCommandContext();
            var connectedNode  = commandContext.GetConnectedNode(null);
            var command        = new MessageSignCommand(commandContext, Substitute.For <ILogger>());

            //Act
            TestCommandHelpers.GenerateRequest(commandContext, command, "-n", "node1", "-m", "hello world");

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

            requestSent.Should().BeOfType(typeof(SignMessageRequest));
        }
コード例 #2
0
        public void SignMessageResponse_Can_Get_Output()
        {
            //Arrange
            var signMessageResponse = new SignMessageResponse();
            var commandContext      = TestCommandHelpers.GenerateCliResponseCommandContext(_testScheduler);
            var messageSignCommand  = new MessageSignCommand(commandContext, Substitute.For <ILogger>());

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

            _testScheduler.Start();

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