コード例 #1
0
        public void RiakBucketKeyKeyDataInputWithTypeSerializesCorrectly()
        {
            var inputs = new List <Tuple <RiakObjectId, object> >
            {
                new Tuple <RiakObjectId, object>(new RiakObjectId("qux_type", "foo", "baz"), 130),
                new Tuple <RiakObjectId, object>(new RiakObjectId("dog_type", "dooby", "scooby"),
                                                 new { la = "ding", ray = "me", wit = 0 })
            };

            var input = new RiakBucketKeyKeyDataInput()
                        .Add(new RiakObjectId("qux_type", "foo", "bar"), "")
                        .Add(new RiakObjectId("qux_type", "foo", "bar"), "baz")
                        .Add(inputs)                // IEnumerable based builder
                        .Add(inputs[0], inputs[1]); // Params based builder


            var s = Serialize(input.WriteJson);

            Assert.AreEqual(s,
                            "\"inputs\":[" +
                            "[\"foo\",\"bar\",\"\",\"qux_type\"]," +
                            "[\"foo\",\"bar\",\"baz\",\"qux_type\"]," +
                            "[\"foo\",\"baz\",130,\"qux_type\"]," +
                            "[\"dooby\",\"scooby\",{\"la\":\"ding\",\"ray\":\"me\",\"wit\":0},\"dog_type\"]," +
                            "[\"foo\",\"baz\",130,\"qux_type\"]," +
                            "[\"dooby\",\"scooby\",{\"la\":\"ding\",\"ray\":\"me\",\"wit\":0},\"dog_type\"]]");
        }
コード例 #2
0
        public void RiakBucketKeyKeyDataInputSeralisesCorrectly()
        {
            var input = new RiakBucketKeyKeyDataInput()
                        .Add("foo", "bar", "baz")
                        .Add("foo", "baz", 130)
                        .Add("dooby", "scooby", new { la = "ding", ray = "me", wit = 0 });

            var s = Serialize(input.WriteJson);

            Assert.AreEqual(s, "\"inputs\":[[\"foo\",\"bar\",\"baz\"],[\"foo\",\"baz\",130],[\"dooby\",\"scooby\",{\"la\":\"ding\",\"ray\":\"me\",\"wit\":0}]]");
        }
コード例 #3
0
        public void RiakBucketKeyKeyDataInputSerializesCorrectly()
        {
            var inputs = new List <Tuple <RiakObjectId, object> >
            {
                new Tuple <RiakObjectId, object>(new RiakObjectId("foo", "baz"), 130),
                new Tuple <RiakObjectId, object>(new RiakObjectId("dooby", "scooby"),
                                                 new { la = "ding", ray = "me", wit = 0 })
            };

            var input = new RiakBucketKeyKeyDataInput()
                        .Add(new RiakObjectId("foo", "bar"), "baz")
                        .Add(inputs)                // IEnumerable based builder
                        .Add(inputs[0], inputs[1]); // Params based builder


            var s = Serialize(input.WriteJson);

            Assert.AreEqual(s, SerializedRiakBucketKeyKeyDataInput);
        }
コード例 #4
0
        public void RiakBucketKeyKeyDataInputSerializesCorrectlyOldInterface()
        {
            var inputs = new List <Tuple <string, string, object> >
            {
                new Tuple <string, string, object>("foo", "baz", 130),
                new Tuple <string, string, object>("dooby", "scooby", new { la = "ding", ray = "me", wit = 0 })
            };

#pragma warning disable 612, 618
            var input = new RiakBucketKeyKeyDataInput()
                        .Add("foo", "bar", "baz")
                        .Add(inputs)                // IEnumerable based builder
                        .Add(inputs[0], inputs[1]); // Params based builder
#pragma warning restore 612, 618

            var s = Serialize(input.WriteJson);

            Assert.AreEqual(s, SerializedRiakBucketKeyKeyDataInput);
        }
        public void RiakBucketKeyKeyDataInputSerializesCorrectly()
        {
            var inputs = new List<Tuple<RiakObjectId, object>>
            {
                new Tuple<RiakObjectId, object>(new RiakObjectId("foo", "baz"), 130),
                new Tuple<RiakObjectId, object>(new RiakObjectId("dooby", "scooby"),
                    new {la = "ding", ray = "me", wit = 0})
            };

            var input = new RiakBucketKeyKeyDataInput()
                .Add(new RiakObjectId("foo", "bar"), "baz")
                .Add(inputs) // IEnumerable based builder
                .Add(inputs[0], inputs[1]); // Params based builder


            var s = Serialize(input.WriteJson);

            Assert.AreEqual(s, SerializedRiakBucketKeyKeyDataInput);
        }
        public void RiakBucketKeyKeyDataInputSerializesCorrectlyOldInterface()
        {
            var inputs = new List<Tuple<string, string, object>>
            {
                new Tuple<string, string, object>("foo", "baz", 130),
                new Tuple<string, string, object>("dooby", "scooby", new {la = "ding", ray = "me", wit = 0})
            };

#pragma warning disable 612, 618
            var input = new RiakBucketKeyKeyDataInput()
                .Add("foo", "bar", "baz")
                .Add(inputs) // IEnumerable based builder
                .Add(inputs[0], inputs[1]); // Params based builder
#pragma warning restore 612, 618

            var s = Serialize(input.WriteJson);

            Assert.AreEqual(s, SerializedRiakBucketKeyKeyDataInput);
        }
コード例 #7
0
 public RiakMapReduceQuery Inputs(RiakBucketKeyKeyDataInput riakBucketKeyKeyDataInputs)
 {
     _inputs = riakBucketKeyKeyDataInputs;
     return(this);
 }
コード例 #8
0
 /// <summary>
 /// Add a collection of <see cref="RiakObjectId"/> / KeyData sets to the list of inputs.
 /// </summary>
 /// <param name="riakBucketKeyKeyDataInputs">The <see cref="RiakBucketKeyKeyDataInput"/> to add to the list of inputs.</param>
 /// <returns>A reference to this updated instance, for fluent chaining.</returns>
 public RiakMapReduceQuery Inputs(RiakBucketKeyKeyDataInput riakBucketKeyKeyDataInputs)
 {
     inputs = riakBucketKeyKeyDataInputs;
     return this;
 }
        public void RiakBucketKeyKeyDataInputWithTypeSerializesCorrectly()
        {
            var inputs = new List<Tuple<RiakObjectId, object>>
            {
                new Tuple<RiakObjectId, object>(new RiakObjectId("qux_type", "foo", "baz"), 130),
                new Tuple<RiakObjectId, object>(new RiakObjectId("dog_type", "dooby", "scooby"),
                    new {la = "ding", ray = "me", wit = 0})
            };

            var input = new RiakBucketKeyKeyDataInput()
                .Add(new RiakObjectId("qux_type", "foo", "bar"), "")
                .Add(new RiakObjectId("qux_type", "foo", "bar"), "baz")
                .Add(inputs) // IEnumerable based builder
                .Add(inputs[0], inputs[1]); // Params based builder


            var s = Serialize(input.WriteJson);

            Assert.AreEqual(s,
                "\"inputs\":[" +
                "[\"foo\",\"bar\",\"\",\"qux_type\"]," +
                "[\"foo\",\"bar\",\"baz\",\"qux_type\"]," +
                "[\"foo\",\"baz\",130,\"qux_type\"]," +
                "[\"dooby\",\"scooby\",{\"la\":\"ding\",\"ray\":\"me\",\"wit\":0},\"dog_type\"]," +
                "[\"foo\",\"baz\",130,\"qux_type\"]," +
                "[\"dooby\",\"scooby\",{\"la\":\"ding\",\"ray\":\"me\",\"wit\":0},\"dog_type\"]]");
        }