//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldHandleMultipleClose() internal virtual void ShouldHandleMultipleClose() { // given MemoryAllocationTracker tracker = new LocalMemoryTracker(); UnsafeDirectByteBufferAllocator factory = new UnsafeDirectByteBufferAllocator(tracker); // when factory.Allocate(256); factory.Close(); // then assertEquals(0, tracker.UsedDirectMemory()); factory.Close(); assertEquals(0, tracker.UsedDirectMemory()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldNotAllocateAfterClosed() internal virtual void ShouldNotAllocateAfterClosed() { // given UnsafeDirectByteBufferAllocator factory = new UnsafeDirectByteBufferAllocator(new LocalMemoryTracker()); factory.Close(); // when try { factory.Allocate(8); } catch (System.InvalidOperationException) { // then good } }