public void CanHandle_WhenParametersNull_ExpectException()
        {
            // Arrange
            var target = new StringJsonRequestBuilder();
            target.CanHandle(null);

            // Assert
        }
        public void Create_WhenParametersNotTypeOfStringParameter_ExpectException()
        {
            // Arrange
            Mock<IParameters> parameters = new Mock<IParameters>();

            var target = new StringJsonRequestBuilder();
            target.Build(parameters.Object);

            // Assert
        }
        public void CanHandle_WhenMethodTypeIsString_ExpectTrue()
        {
            // Arrange
            const bool expected = true;
            Mock<IParameters> parameters = new Mock<IParameters>();
            parameters.Setup(p => p.MethodType).Returns(MethodType.String);

            // Act
            var target = new StringJsonRequestBuilder();
            var actual = target.CanHandle(parameters.Object);

            // Assert
            actual.Should().Equal(expected);
        }
        public void WhenParametersCorrect_ExpectJsonReturned()
        {
            // Arrange
            const int numberOfItems = 1;
            const int length = 10;
            const string charactersAllowed = "abc";
            const bool allowDuplicates = false;

            JObject expected =
                new JObject(
                    new JProperty(JsonRpcConstants.NUMBER_ITEMS_RETURNED_PARAMETER_NAME, numberOfItems),
                    new JProperty(JsonRpcConstants.LENGTH_PARAMETER_NAME, length),
                    new JProperty(JsonRpcConstants.CHARACTERS_ALLOWED_PARAMETER_NAME, charactersAllowed),
                    new JProperty(JsonRpcConstants.REPLACEMENT_PARAMETER_NAME, allowDuplicates)
                );

            // Act
                var parameters = StringParameters.Create(numberOfItems, length, charactersAllowed, allowDuplicates);
                var target = new StringJsonRequestBuilder();
                var actual = target.Build(parameters);

                // Assert
                actual.Should().Equal(expected);
        }