public void When_Type_Is_Object_DataFormat_Json_Is_Used()
        {
            var key = "When_Type_Is_Object_GetQ_Uses_DataFormat_Json";

            //delete the value if it exists
            var delete = new Delete(key, GetVBucket(), new AutoByteConverter(), new DefaultTranscoder(new ManualByteConverter()));

            IOStrategy.Execute(delete);

            //Add the key
            var add = new Add <dynamic>(key, new { foo = "foo" }, GetVBucket(), new AutoByteConverter(), new DefaultTranscoder(new ManualByteConverter()));

            Assert.IsTrue(IOStrategy.Execute(add).Success);

            var getQ = new GetQ <dynamic>(key, GetVBucket(), new AutoByteConverter(),
                                          new DefaultTranscoder(new AutoByteConverter()));

            getQ.CreateExtras();
            Assert.AreEqual(DataFormat.Json, getQ.Format);

            var result = IOStrategy.Execute(getQ);

            Assert.IsTrue(result.Success);

            Assert.AreEqual(DataFormat.Json, getQ.Format);
        }
        public void When_Type_Is_Object_DataFormat_Json_Is_Used()
        {
            var key = "When_Type_Is_Object_GetQ_Uses_DataFormat_Json";

            //delete the value if it exists
            var delete = new Delete(key, GetVBucket(), Transcoder, OperationLifespanTimeout);

            IOService.Execute(delete);

            //Add the key
            var add = new Add <dynamic>(key, new { foo = "foo" }, GetVBucket(), Transcoder, OperationLifespanTimeout);

            Assert.IsTrue(IOService.Execute(add).Success);

            var getQ = new GetQ <dynamic>(key, GetVBucket(), Transcoder, OperationLifespanTimeout);

            getQ.CreateExtras();
            Assert.AreEqual(DataFormat.Json, getQ.Format);

            var result = IOService.Execute(getQ);

            Assert.IsTrue(result.Success);

            Assert.AreEqual(DataFormat.Json, getQ.Format);
        }
Beispiel #3
0
        public void When_Type_Is_String_DataFormat_String_Is_Used()
        {
            var key = "When_Type_Is_String_GetQ_Uses_DataFormat_String";

            //delete the value if it exists
            var delete = new Delete(key, GetVBucket(), Transcoder, OperationLifespanTimeout);

            IOStrategy.Execute(delete);

            //Add the key
            var add = new Add <string>(key, "foo", GetVBucket(), Transcoder, OperationLifespanTimeout);

            Assert.IsTrue(IOStrategy.Execute(add).Success);

            var getQ = new GetQ <string>(key, GetVBucket(), Transcoder, OperationLifespanTimeout);

            getQ.CreateExtras();
            Assert.AreEqual(DataFormat.String, getQ.Format);

            var result = IOStrategy.Execute(getQ);

            Assert.IsTrue(result.Success);

            Assert.AreEqual(DataFormat.String, getQ.Format);
        }
Beispiel #4
0
        public void When_Type_Is_ByteArray_DataFormat_Binary_Is_Used()
        {
            var key = "When_Type_Is_Object_GetQ_Uses_DataFormat_Json";

            //delete the value if it exists
            var delete = new Delete(key, GetVBucket(), Transcoder, OperationLifespanTimeout);

            IOStrategy.Execute(delete);

            //Add the key
            var add = new Add <byte[]>(key, new byte[] { 0x0 }, GetVBucket(), Transcoder, OperationLifespanTimeout);

            Assert.IsTrue(IOStrategy.Execute(add).Success);

            var getQ = new GetQ <byte[]>(key, GetVBucket(), Transcoder, OperationLifespanTimeout);

            getQ.CreateExtras();
            Assert.AreEqual(DataFormat.Binary, getQ.Format);

            var result = IOStrategy.Execute(getQ);

            Assert.IsTrue(result.Success);

            Assert.AreEqual(DataFormat.Binary, getQ.Format);
        }
        public void When_Type_Is_Object_DataFormat_Json_Is_Used()
        {
            var key = "When_Type_Is_Object_GetQ_Uses_DataFormat_Json";

            //delete the value if it exists
            var delete = new Delete(key, GetVBucket(), Transcoder, OperationLifespanTimeout);
            IOService.Execute(delete);

            //Add the key
            var add = new Add<dynamic>(key, new { foo = "foo" }, GetVBucket(), Transcoder, OperationLifespanTimeout);
            Assert.IsTrue(IOService.Execute(add).Success);

            var getQ = new GetQ<dynamic>(key, GetVBucket(), Transcoder, OperationLifespanTimeout);

            getQ.CreateExtras();
            Assert.AreEqual(DataFormat.Json, getQ.Format);

            var result = IOService.Execute(getQ);
            Assert.IsTrue(result.Success);

            Assert.AreEqual(DataFormat.Json, getQ.Format);
        }
        public void When_Type_Is_String_DataFormat_String_Is_Used()
        {
            var key = "When_Type_Is_String_GetQ_Uses_DataFormat_String";

            //delete the value if it exists
            var delete = new Delete(key, GetVBucket(), Transcoder, OperationLifespanTimeout);
            IOStrategy.Execute(delete);

            //Add the key
            var add = new Add<string>(key, "foo", GetVBucket(), Transcoder, OperationLifespanTimeout);
            Assert.IsTrue(IOStrategy.Execute(add).Success);

            var getQ = new GetQ<string>(key, GetVBucket(), Transcoder, OperationLifespanTimeout);

            getQ.CreateExtras();
            Assert.AreEqual(DataFormat.String, getQ.Format);

            var result = IOStrategy.Execute(getQ);
            Assert.IsTrue(result.Success);

            Assert.AreEqual(DataFormat.String, getQ.Format);
        }
        public void When_Type_Is_ByteArray_DataFormat_Binary_Is_Used()
        {
            var key = "When_Type_Is_Object_GetQ_Uses_DataFormat_Json";

            //delete the value if it exists
            var delete = new Delete(key, GetVBucket(), Transcoder, OperationLifespanTimeout);
            IOStrategy.Execute(delete);

            //Add the key
            var add = new Add<byte[]>(key, new byte[] { 0x0 }, GetVBucket(), Transcoder, OperationLifespanTimeout);
            Assert.IsTrue(IOStrategy.Execute(add).Success);

            var getQ = new GetQ<byte[]>(key, GetVBucket(), Transcoder, OperationLifespanTimeout);

            getQ.CreateExtras();
            Assert.AreEqual(DataFormat.Binary, getQ.Format);

            var result = IOStrategy.Execute(getQ);
            Assert.IsTrue(result.Success);

            Assert.AreEqual(DataFormat.Binary, getQ.Format);
        }