public void Can_fetch_JSON_from_NamedParameters()
        {
            var request = new AnalyticsRequest(Statement);

            request.AddNamedParameter("theykey", "thevalue");

            var json = request.GetParametersAsJson();

            Assert.Equal("{\"theykey\":\"thevalue\"}", json);
        }
Beispiel #2
0
        public void Can_add_named_parameter()
        {
            var request = new AnalyticsRequest(Statement);

            request.AddNamedParameter("my_string", "value");
            request.AddNamedParameter("my_int", 10);
            request.AddNamedParameter("my_bool", true);

            var formValues = request.GetFormValues();

            Assert.Equal("value", formValues["my_string"]);
            Assert.Equal(10, formValues["my_int"]);
            Assert.Equal(true, formValues["my_bool"]);

            var json = JsonConvert.DeserializeObject <dynamic>(
                request.GetFormValuesAsJson()
                );

            Assert.Equal("value", json.my_string.Value);
            Assert.Equal(10, json.my_int.Value);
            Assert.Equal(true, json.my_bool.Value);
        }