コード例 #1
0
        public void Get_resource_from_resource_pool_when_has_no_avaliable()
        {
            var respurcePool = new ResourcePool();

            Assert.Equal(0, respurcePool.GetAvaliableResourceCount());
            Assert.Equal(0, respurcePool.GetAllocatedResourceCount());

            respurcePool.GetResource("Resource1");
            Assert.Equal(0, respurcePool.GetAvaliableResourceCount());
            Assert.Equal(1, respurcePool.GetAllocatedResourceCount());
        }
コード例 #2
0
        public void Get_resource_from_resource_pool()
        {
            var resource1 = new Resource("Resource1");
            var avaliable = new List <Resource>()
            {
                resource1
            };
            var respurcePool = new ResourcePool(null, avaliable);

            respurcePool.GetResource("Resource1");
            Assert.Equal(1, respurcePool.GetAllocatedResourceCount());
        }