public void BuildRequestParamsHandlesComplexObject()
        {
            var complexObject = new TestParams
            {
                MyString = "inner-foo"
            };

            var mockParser = new Mock <IResponseParser>();

            mockParser.Setup(p => p.SerializeMessage(complexObject))
            .Returns("{\"json\": \"result\"}")
            .Verifiable();

            var subject = new RestSharpRequestHandler("xxx");

            subject.ResponseParser = mockParser.Object;

            var testParams = new TestParams
            {
                MyInt           = 90,
                MyComplexObject = complexObject
            };

            var result = subject.BuildRequestParams(testParams);

            Assert.Equal(2, result.Keys.Count);
            Assert.Equal("{\"json\": \"result\"}", result["my_complex_object"]);
            Assert.Equal("90", result["my_int"]);

            mockParser.Verify();
        }
        public void BuildRequestParamsHandlesBasicObject()
        {
            var subject = new RestSharpRequestHandler("xxx");
            var testParams = new TestParams
            {
                MyString = "foo",
                MyBool = true,
                MyBytes = new byte[10],
                MyEnum = TestEnumParams.TestItem2,
                MyInt = 90
            };

            var result = subject.BuildRequestParams(testParams);

            Assert.Equal(4, result.Keys.Count);
            Assert.Equal("foo", result["my_string"]);
            Assert.Equal("true", result["my_bool"]);
            Assert.Equal("test_item2", result["my_enum"]);
            Assert.Equal("90", result["my_int"]);
        }
        public void BuildRequestParamsHandlesBasicObject()
        {
            var subject    = new RestSharpRequestHandler("xxx");
            var testParams = new TestParams
            {
                MyString = "foo",
                MyBool   = true,
                MyBytes  = new byte[10],
                MyEnum   = TestEnumParams.TestItem2,
                MyInt    = 90
            };

            var result = subject.BuildRequestParams(testParams);

            Assert.Equal(4, result.Keys.Count);
            Assert.Equal("foo", result["my_string"]);
            Assert.Equal("true", result["my_bool"]);
            Assert.Equal("test_item2", result["my_enum"]);
            Assert.Equal("90", result["my_int"]);
        }
        public void BuildRequestParamsHandlesComplexObject()
        {
            var complexObject = new TestParams
            {
                MyString = "inner-foo"
            };

            var mockParser = new Mock<IResponseParser>();

            mockParser.Setup(p => p.SerializeMessage(complexObject))
                      .Returns("{\"json\": \"result\"}")
                      .Verifiable();

            var subject = new RestSharpRequestHandler("xxx");
            subject.ResponseParser = mockParser.Object;

            var testParams = new TestParams
            {
                MyInt = 90,
                MyComplexObject = complexObject
            };

            var result = subject.BuildRequestParams(testParams);

            Assert.Equal(2, result.Keys.Count);
            Assert.Equal("{\"json\": \"result\"}", result["my_complex_object"]);
            Assert.Equal("90", result["my_int"]);

            mockParser.Verify();
        }