Ejemplo n.º 1
0
        public void Ctor_Dispose_Success(int sizeInMegabytes)
        {
            var memoryFailPoint = new MemoryFailPoint(sizeInMegabytes);

            memoryFailPoint.Dispose();
            memoryFailPoint.Dispose();
        }
Ejemplo n.º 2
0
        public virtual bool IsSpaceAvailable(int sizeInMb)
        {
            if (sizeInMb < 1)
            {
                return(true);
            }

            bool isAvailable = true;

            MemoryFailPoint _memoryFailPoint = null;

            try
            {
                _memoryFailPoint = new MemoryFailPoint(sizeInMb);
            }
            catch (InsufficientMemoryException)
            {
                isAvailable = false;
            }
            catch (NotImplementedException)
            {
                _logger.Warn("MemoryFailPoint is not implemented on this platform. The MemoryManager.IsSpaceAvailable() will just return true.");
            }
            finally
            {
                if (_memoryFailPoint != null)
                {
                    _memoryFailPoint.Dispose();
                }
            }

            return(isAvailable);
        }
Ejemplo n.º 3
0
        public static void MemoryFailPointTestNoThrow()
        {
            MemoryFailPoint memFailPoint = null;

            memFailPoint = new MemoryFailPoint(1);
            memFailPoint.Dispose();
            memFailPoint = new MemoryFailPoint(2);
            memFailPoint.Dispose();
        }