public void Create_WhenBuildReturnsNull_ExpectEmptyParametersNode()
        {
            // Act
            const int id = 999;
            const string apiKey = "Test_APIKEY";

            var settingsManagerMock = MockHelper.MockSettingsManager(apiKey);
            RandomNumberGenerator.Instance = MockHelper.SetupIdMock(id).Object;

            var expected = new JObject(
                new JProperty(JsonRpcConstants.RPC_PARAMETER_NAME, JsonRpcConstants.RPC_VALUE),
                new JProperty(JsonRpcConstants.METHOD_PARAMETER_NAME, "generateDecimalFractions"),
                new JProperty(JsonRpcConstants.PARAMETERS_PARAMETER_NAME,
                    new JObject(
                        new JProperty(RandomOrgConstants.APIKEY_KEY, apiKey))
                    ),
                new JProperty(JsonRpcConstants.ID_PARAMETER_NAME, id)
                );

            // Act
            CommonParameters parameters = new CommonParameters(MethodType.Decimal);
            Mock<IJsonRequestBuilder> mockBuilder = new Mock<IJsonRequestBuilder>();
            mockBuilder.Setup(m => m.Build(parameters)).Returns((JObject) null);

            var target = new JsonRequestBuilder(mockBuilder.Object, settingsManagerMock.Object);
            var actual = target.Build(parameters);

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

        }
        public void WhenConstructorInitialized_ExpectPropertiesSetCorrectly()
        {
            // Arrange
            const int expectedId = 9999;
            const MethodType expectedMethod = MethodType.Integer;
            const bool expectedVerifyOriginator = true;

            RandomNumberGenerator.Instance = MockHelper.SetupIdMock(expectedId).Object;

            // Act
            var actual = new CommonParameters(expectedMethod, expectedVerifyOriginator);

            // Assert
            actual.MethodType.Should().Equal(expectedMethod);
            actual.VerifyOriginator.Should().Equal(expectedVerifyOriginator);
            actual.Id.Should().Equal(expectedId);
        }
 public void GetMethodName_WhenNull_ExpectCorrectMethodName()
 {
     // Arrange
     // Act
     var target = new CommonParameters(MethodType.Blob);
     var actual = target.GetMethodName();
     actual.Should().Equal(RandomOrgConstants.BLOB_METHOD);
 }
        public void GetMethodName_WhenCalled_ExpectCorrectMethodName()
        {
            // Arrange

            // Act
            var target = new CommonParameters(MethodType.Blob);
            var actual = target.GetMethodName();
            actual.Should().Equal(RandomOrgConstants.BLOB_METHOD);

            target = new CommonParameters(MethodType.Blob, true);
            actual = target.GetMethodName();
            actual.Should().Equal(RandomOrgConstants.BLOB_SIGNED_METHOD);

            target = new CommonParameters(MethodType.Decimal);
            actual = target.GetMethodName();
            actual.Should().Equal(RandomOrgConstants.DECIMAL_METHOD);

            target = new CommonParameters(MethodType.Decimal, true);
            actual = target.GetMethodName();
            actual.Should().Equal(RandomOrgConstants.DECIMAL_SIGNED_METHOD);

            target = new CommonParameters(MethodType.Gaussian);
            actual = target.GetMethodName();
            actual.Should().Equal(RandomOrgConstants.GAUSSIAN_METHOD);

            target = new CommonParameters(MethodType.Gaussian, true);
            actual = target.GetMethodName();
            actual.Should().Equal(RandomOrgConstants.GAUSSIAN_SIGNED_METHOD);

            target = new CommonParameters(MethodType.Integer);
            actual = target.GetMethodName();
            actual.Should().Equal(RandomOrgConstants.INTEGER_METHOD);

            target = new CommonParameters(MethodType.Integer, true);
            actual = target.GetMethodName();
            actual.Should().Equal(RandomOrgConstants.INTEGER_SIGNED_METHOD);

            target = new CommonParameters(MethodType.String);
            actual = target.GetMethodName();
            actual.Should().Equal(RandomOrgConstants.STRING_METHOD);

            target = new CommonParameters(MethodType.String, true);
            actual = target.GetMethodName();
            actual.Should().Equal(RandomOrgConstants.STRING_SIGNED_METHOD);

            target = new CommonParameters(MethodType.Uuid);
            actual = target.GetMethodName();
            actual.Should().Equal(RandomOrgConstants.UUID_METHOD);

            target = new CommonParameters(MethodType.Uuid, true);
            actual = target.GetMethodName();
            actual.Should().Equal(RandomOrgConstants.UUID_SIGNED_METHOD);

            target = new CommonParameters(MethodType.Usage);
            actual = target.GetMethodName();
            actual.Should().Equal(RandomOrgConstants.USAGE_METHOD);

            target = new CommonParameters(MethodType.Usage, true);
            actual = target.GetMethodName();
            actual.Should().Equal(RandomOrgConstants.USAGE_METHOD);
        }