public void DeleteBucketDeletesAllKeysInABucketAsynchronously()
        {
            // add multiple keys
            var bucket = Guid.NewGuid().ToString();

            for (var i = 1; i < 11; i++)
            {
                var doc = new RiakObject(bucket, i.ToString(), new { value = i });

                Client.Put(doc);
            }

            var keyList = Client.ListKeys(bucket);

            keyList.Value.Count().ShouldEqual(10);

            var asyncTester = new AsyncMethodTester <IEnumerable <RiakResult> >();

            Client.Async.DeleteBucket(bucket, asyncTester.HandleResult);
            var result = asyncTester.Result;

            // This might fail if you check straight away
            // because deleting takes time behind the scenes.
            // So wait in case (yup, you can shoot me if you like!)
            Thread.Sleep(4000);

            keyList = Client.ListKeys(bucket);
            keyList.Value.Count().ShouldEqual(0);
            Client.ListBuckets().Value.Contains(bucket).ShouldBeFalse();
        }
        public void ServerInfoIsSuccessfullyExtractedAsynchronously()
        {
            var asyncTester = new AsyncMethodTester <RiakResult <RiakServerInfo> >();

            Client.Async.GetServerInfo(asyncTester.HandleResult);
            asyncTester.Result.IsSuccess.ShouldBeTrue();
        }
        public void DeleteBucketDeletesAllKeysInABucketAsynchronously()
        {
            // add multiple keys
            var bucket = Guid.NewGuid().ToString();

            for (var i = 1; i < 11; i++)
            {
                var doc = new RiakObject(bucket, i.ToString(), new { value = i });

                Client.Put(doc);
            }

            var keyList = Client.ListKeys(bucket);
            keyList.Value.Count().ShouldEqual(10);

            var asyncTester = new AsyncMethodTester<IEnumerable<RiakResult>>();
            Client.Async.DeleteBucket(bucket, asyncTester.HandleResult);
            var result = asyncTester.Result;

            // This might fail if you check straight away
            // because deleting takes time behind the scenes.
            // So wait in case (yup, you can shoot me if you like!)
            Thread.Sleep(4000);

            keyList = Client.ListKeys(bucket);
            keyList.Value.Count().ShouldEqual(0);
            Client.ListBuckets().Value.Contains(bucket).ShouldBeFalse();
        }
 public void ServerInfoIsSuccessfullyExtractedAsynchronously()
 {
     var asyncTester = new AsyncMethodTester<RiakResult<RiakServerInfo>>();
     Client.Async.GetServerInfo(asyncTester.HandleResult);
     asyncTester.Result.IsSuccess.ShouldBeTrue();
 }
Exemplo n.º 5
0
 protected RiakAsyncClientTestBase()
 {
     ClientMock  = new Mock <IRiakClient>();
     AsyncClient = new RiakAsyncClient(ClientMock.Object);
     Tester      = new AsyncMethodTester <TResult>();
 }