예제 #1
0
        public async Task TestLoadBalancer()
        {
            var store = new OdinMemoryStore();
            var counter1 = new Counter(store);
            var counter2 = new Counter(store);

            var loadBalancer = new LoadBalancer(LoadBalancer.Strategy.RoundRobin, counter1, counter2);
            await OdinTests.BasicOperations(loadBalancer);

            Assert.AreNotSame(0, counter1.PutCount);
            Assert.AreNotSame(0, counter2.PutCount);

        }
예제 #2
0
        public async Task TestCounter()
        {
            var store = new OdinMemoryStore();
            var counter = new Counter(store);

            Assert.AreEqual(0, counter.PutCount);
            await counter.Put("x", "y");
            Assert.AreEqual(1, counter.PutCount);

            Assert.AreEqual(0, counter.DeleteCount);
            await counter.Delete("x");
            Assert.AreEqual(1, counter.DeleteCount);

            await OdinTests.BasicOperations(counter);
        }
예제 #3
0
        // this looks broken
        //[TestMethod]
        public async Task TestRetry()
        {
            var counter = new Counter(null);
            var retry = new Retry(counter);
            try
            {
                await retry.Put("foo", "bar");
            }
            catch { }
            Assert.AreEqual(5, counter.PutCount);

            var odin = new OdinMemoryStore();
            retry = new Retry(odin);
            await OdinTests.BasicOperations(retry);
        }