コード例 #1
0
        public void ConstructorWithIntArg_WhenCalled_SetsPoolSize()
        {
            int poolSize = 8;
            SimplePoolFactory factory = new SimplePoolFactory(poolSize);

            Assert.AreEqual(poolSize, factory.PoolSize);
        }
コード例 #2
0
        public void CreatePool_WhenCalled_CreateSimplePool()
        {
            MockRepository repo = new MockRepository();
            var poolableObjectFactory = repo.StrictMock<IPoolableObjectFactory>();
            Expect.Call(poolableObjectFactory.MakeObject()).Return(new object()).Repeat.Times(SimplePoolFactory.DefaultPoolSize);
            SimplePoolFactory factory = new SimplePoolFactory();
            repo.ReplayAll();

            var result = factory.CreatePool(poolableObjectFactory);

            Assert.IsInstanceOfType(typeof(SimplePool), result);
            repo.VerifyAll();
        }
コード例 #3
0
        public void ConstructorWithNoArgs_WhenCalled_SetsDefaultPoolSize()
        {
            SimplePoolFactory factory = new SimplePoolFactory();

            Assert.AreEqual(SimplePoolFactory.DefaultPoolSize, factory.PoolSize);
        }