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

            request.AddPositionalParameter("thevalue");

            var json = request.GetParametersAsJson();

            Assert.Equal("[\"thevalue\"]", json);
        }
Exemple #2
0
        public void Can_add_positional_parameter()
        {
            var request = new AnalyticsRequest(Statement);

            request.AddPositionalParameter("value");
            request.AddPositionalParameter(10);
            request.AddPositionalParameter(true);

            var formValues = request.GetFormValues();
            var args       = formValues["args"] as object[];

            Assert.NotNull(args);
            Assert.Equal("value", args[0]);
            Assert.Equal(10, args[1]);
            Assert.Equal(true, args[2]);

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

            Assert.Equal("value", json.args[0].Value);
            Assert.Equal(10, json.args[1].Value);
            Assert.Equal(true, json.args[2].Value);
        }