コード例 #1
0
        protected static IMemcachedCluster NewCluster(TServerFixture servers)
        {
            var retval = new MemcachedCluster(servers.Run(),
                                              Debugger.IsAttached
                                                                        ? new MemcachedClusterOptions {
                SocketFactory = new AsyncSocketFactory(new SocketOptions {
                    ConnectionTimeout = TimeSpan.FromSeconds(3600)
                })
            }
                                                                        : null
                                              );

            retval.Start();

            return(retval);
        }
コード例 #2
0
        private IMemcachedCluster GetCustomCluster()
        {
            // operations being tested in this class are expected to fail early without bringing their node down
            // the mockInstance will throw if one of the nodes become dead
            var mockFactory  = new Mock <IFailurePolicyFactory>();
            var mockInstance = new Mock <IFailurePolicy>(MockBehavior.Strict);

            mockFactory.Setup(f => f.Create(It.IsAny <INode>())).Returns(mockInstance.Object);

            var retval = new MemcachedCluster(fixture.Run(), new MemcachedClusterOptions {
                FailurePolicyFactory = mockFactory.Object
            });

            retval.Start();

            return(retval);
        }