当前位置: 首页>>代码示例>>C#>>正文


C# FakeConnection.SetResponse方法代码示例

本文整理汇总了C#中FakeConnection.SetResponse方法的典型用法代码示例。如果您正苦于以下问题:C# FakeConnection.SetResponse方法的具体用法?C# FakeConnection.SetResponse怎么用?C# FakeConnection.SetResponse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FakeConnection的用法示例。


在下文中一共展示了FakeConnection.SetResponse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: When_Key_Is_Found_GetAsync_Returns_True

        public async void When_Key_Is_Found_GetAsync_Returns_True()
        {
            var connection = new FakeConnection();
            connection.SetResponse(ResponsePackets.GET_OPAQUE_5_SUCCESS);
            _connectionPool.AddConnection(connection);

            var bucket = GetBucketForKey("key1");
            var result = await bucket.GetAsync<int>("key1");

            Assert.IsTrue(result.Success);
            Assert.AreEqual(ResponseStatus.Success, result.Status);
        }
开发者ID:hyah,项目名称:couchbase-net-client,代码行数:12,代码来源:MemcachedBucket_Async_Tests.cs

示例2: When_Add_Succeeds_InsertAsync_Returns_Success

        public async Task When_Add_Succeeds_InsertAsync_Returns_Success()
        {
            var connection = new FakeConnection();
            connection.SetResponse(ResponsePackets.ADD_SUCCESS);
            _connectionPool.AddConnection(connection);

            var bucket = GetBucketForKey("key1");
            var result = await bucket.InsertAsync("key1", "NA");

            Assert.IsTrue(result.Success);
            Assert.AreEqual(ResponseStatus.Success, result.Status);
        }
开发者ID:brantburnett,项目名称:couchbase-net-client,代码行数:12,代码来源:CouchbaseBucket_Async_Tests.cs

示例3: When_Add_Fails_InsertAsync_Returns_KEY_EXISTS

        public async Task When_Add_Fails_InsertAsync_Returns_KEY_EXISTS()
        {
            var connection = new FakeConnection();
            connection.SetResponse(ResponsePackets.Add_FAILED_KEY_EXISTS);
            _connectionPool.AddConnection(connection);

            var bucket = GetBucketForKey("key1");
            var result = await bucket.InsertAsync("key1", "NA");

            Assert.IsFalse(result.Success);
            Assert.AreEqual(ResponseStatus.KeyExists, result.Status);
        }
开发者ID:brantburnett,项目名称:couchbase-net-client,代码行数:12,代码来源:CouchbaseBucket_Async_Tests.cs

示例4: Test_AppendAsync

        public async Task Test_AppendAsync()
        {
            var connection = new FakeConnection();
            connection.SetResponse(ResponsePackets.INSERT_SUCCESS);
            _connectionPool.AddConnection(connection);

            var key = "Test_Append_Async";
            var bucket = GetBucketForKey(key);
            var result = await bucket.AppendAsync(key, "AB");

            Assert.IsTrue(result.Success);
            Assert.AreEqual(ResponseStatus.Success, result.Status);
        }
开发者ID:brantburnett,项目名称:couchbase-net-client,代码行数:13,代码来源:CouchbaseBucket_Async_Tests.cs

示例5: When_Key_Found_ExistAsync_Returns_True

        public async Task When_Key_Found_ExistAsync_Returns_True()
        {
            var connection = new FakeConnection();
            connection.SetResponse(ResponsePackets.OBSERVE_KEY_DNE);
            _connectionPool.AddConnection(connection);

            var key = "When_Key_Found_ExistAsync_Returns_True";
            var bucket = GetBucketForKey(key);
            var result = await bucket.ExistsAsync(key);

            Assert.IsTrue(result);
        }
开发者ID:brantburnett,项目名称:couchbase-net-client,代码行数:12,代码来源:CouchbaseBucket_Async_Tests.cs

示例6: When_Key_Does_Not_Exist_InsertAsync_Succeeds

        public async Task When_Key_Does_Not_Exist_InsertAsync_Succeeds()
        {
            var connection = new FakeConnection();
            connection.SetResponse(ResponsePackets.INSERT_SUCCESS);
            _connectionPool.AddConnection(connection);

            var key = "When_Key_Does_Not_Exist_InsertAsync_Succeeds";
            var bucket = GetBucketForKey(key);
            var result = await bucket.InsertAsync(key, "NA");

            Assert.IsTrue(result.Success);
            Assert.AreEqual(ResponseStatus.Success, result.Status);
        }
开发者ID:brantburnett,项目名称:couchbase-net-client,代码行数:13,代码来源:CouchbaseBucket_Async_Tests.cs

示例7: When_Key_Found_InsertAsync_Returns_KeyExists

        public async Task When_Key_Found_InsertAsync_Returns_KeyExists()
        {
            var connection = new FakeConnection();
            connection.SetResponse(ResponsePackets.INSERT_KEYEXISTS);
            _connectionPool.AddConnection(connection);

            var key = "When_Key_Found_InsertAsync_Returns_KeyExists";
            var bucket = GetBucketForKey(key);
            var result = await bucket.InsertAsync(key, "NA");

            Assert.IsFalse(result.Success);
            Assert.AreEqual(ResponseStatus.KeyExists, result.Status);
        }
开发者ID:brantburnett,项目名称:couchbase-net-client,代码行数:13,代码来源:CouchbaseBucket_Async_Tests.cs

示例8: When_Key_Found_ReplaceAsync_Returns_Success

        public async Task When_Key_Found_ReplaceAsync_Returns_Success()
        {
            var connection = new FakeConnection();
            connection.SetResponse(ResponsePackets.REPLACE_SUCCESS);
            _connectionPool.AddConnection(connection);

            var key = "When_Key_Found_ReplaceAsync_Returns_Success";
            var bucket = GetBucketForKey(key);
            var result = await bucket.ReplaceAsync(key, "NA");

            Assert.IsTrue(result.Success);
        }
开发者ID:brantburnett,项目名称:couchbase-net-client,代码行数:12,代码来源:CouchbaseBucket_Async_Tests.cs

示例9: When_Key_Does_Not_Exist_ReplaceAsync_Returns_KeyNotFound

        public async Task When_Key_Does_Not_Exist_ReplaceAsync_Returns_KeyNotFound()
        {
            var connection = new FakeConnection();
            connection.SetResponse(ResponsePackets.REPLACE_KEYNOTFOUND);
            _connectionPool.AddConnection(connection);

            var key = "When_Key_Does_Not_Exist_ReplaceAsync_Returns_KeyNotFound";
            var bucket = GetBucketForKey(key);
            var result = await bucket.ReplaceAsync(key, "NA");

            Assert.IsFalse(result.Success);
            Assert.AreEqual(ResponseStatus.KeyNotFound, result.Status);
        }
开发者ID:brantburnett,项目名称:couchbase-net-client,代码行数:13,代码来源:CouchbaseBucket_Async_Tests.cs

示例10: When_NMV_Found_GetAsync_Will_Retry_Until_Timeout

        public async Task When_NMV_Found_GetAsync_Will_Retry_Until_Timeout()
        {
            var connection = new FakeConnection();
            connection.SetResponse(ResponsePackets.GET_WITH_NMV);
            _connectionPool.AddConnection(connection);

            var bucket = GetBucketForKey("key1");
            var result = await bucket.GetAsync<int>("key1");

            Console.WriteLine(result.Message);
            Assert.IsFalse(result.Success);
            Assert.AreEqual(ResponseStatus.OperationTimeout, result.Status);
        }
开发者ID:brantburnett,项目名称:couchbase-net-client,代码行数:13,代码来源:CouchbaseBucket_Async_Tests.cs

示例11: When_Key_Is_Not_Found_GetAsync_Returns_False

        public async Task When_Key_Is_Not_Found_GetAsync_Returns_False()
        {
            var connection = new FakeConnection();
            connection.SetResponse(ResponsePackets.GET_KEY_NOT_FOUND);
            _connectionPool.AddConnection(connection);

            var bucket = GetBucketForKey("key-1");
            var result = await bucket.GetAsync<int>("key-1");

            Assert.IsFalse(result.Success);
            Assert.AreEqual(ResponseStatus.KeyNotFound, result.Status);
        }
开发者ID:brantburnett,项目名称:couchbase-net-client,代码行数:12,代码来源:CouchbaseBucket_Async_Tests.cs

示例12: When_Key_Found_RemoveAsync_Returns_Success

        public async Task When_Key_Found_RemoveAsync_Returns_Success()
        {
            var connection = new FakeConnection();
            connection.SetResponse(ResponsePackets.REMOVE_SUCCESS);
            _connectionPool.AddConnection(connection);

            var key = "When_Key_Found_RemoveAsync_Returns_Success";
            var bucket = GetBucketForKey(key);
            var result = await bucket.RemoveAsync(key);

            Assert.IsTrue(result.Success);
            Assert.AreEqual(ResponseStatus.Success, result.Status);
        }
开发者ID:brantburnett,项目名称:couchbase-net-client,代码行数:13,代码来源:CouchbaseBucket_Async_Tests.cs

示例13: When_Lock_Acquired_GetWithLockReturns_Success

        public async Task When_Lock_Acquired_GetWithLockReturns_Success()
        {
            var connection = new FakeConnection();
            connection.SetResponse(ResponsePackets.GET_WITH_LOCK_SUCCESS);
            _connectionPool.AddConnection(connection);

            var bucket = GetBucketForKey("key1");
#pragma warning disable 618
            var result = await bucket.GetWithLockAsync<string>("key1", new TimeSpan(0, 0, 0, 2));
#pragma warning restore 618

            Console.WriteLine(result.Message);
            Assert.IsTrue(result.Success);
            Assert.AreEqual(ResponseStatus.Success, result.Status);
        }
开发者ID:brantburnett,项目名称:couchbase-net-client,代码行数:15,代码来源:CouchbaseBucket_Async_Tests.cs

示例14: When_Key_Found_ExistAsync_Returns_True

       // [Test]
        //memcached does not support observe...this impl uses observe and fails
        public async void When_Key_Found_ExistAsync_Returns_True()
        {
            var connection = new FakeConnection();
            connection.SetResponse(ResponsePackets.UPSERT_KEYEXISTS_SUCCESS);
            _connectionPool.AddConnection(connection);

            var key = "When_Key_Found_ExistAsync_Returns_True";
            var bucket = GetBucketForKey(key);
            var result = await bucket.ExistsAsync(key);

            Assert.IsTrue(result);
        }
开发者ID:kendallb,项目名称:couchbase-net-client,代码行数:14,代码来源:MemcachedBucket_Async_Tests.cs

示例15: When_Key_Does_Not_Exist_InsertAsync_Succeeds

        public async void When_Key_Does_Not_Exist_InsertAsync_Succeeds()
        {
            var connection = new FakeConnection();
            connection.SetResponse(ResponsePackets.INSERT_SUCCESS);
            _connectionPool.AddConnection(connection);

            var key = "When_Key_Does_Not_Exist_InsertAsync_Succeeds";
            var bucket = GetBucketForKey(key);
            var result = await bucket.InsertAsync(key, "NA");

        }
开发者ID:kendallb,项目名称:couchbase-net-client,代码行数:11,代码来源:MemcachedBucket_Async_Tests.cs


注:本文中的FakeConnection.SetResponse方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。