public void Ctor_Dispose_Success(int sizeInMegabytes) { var memoryFailPoint = new MemoryFailPoint(sizeInMegabytes); memoryFailPoint.Dispose(); memoryFailPoint.Dispose(); }
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); }
public static void MemoryFailPointTestNoThrow() { MemoryFailPoint memFailPoint = null; memFailPoint = new MemoryFailPoint(1); memFailPoint.Dispose(); memFailPoint = new MemoryFailPoint(2); memFailPoint.Dispose(); }