//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldPickFirstAvailableCandidateIntArray() public virtual void ShouldPickFirstAvailableCandidateIntArray() { // GIVEN FailureMonitor monitor = new FailureMonitor(); NumberArrayFactory factory = new NumberArrayFactory_Auto(monitor, NumberArrayFactory.HEAP); // WHEN IntArray array = factory.NewIntArray(KILO, -1); array.Set(KILO - 10, 12345); // THEN assertTrue(array is HeapIntArray); assertEquals(12345, array.Get(KILO - 10)); assertEquals(NumberArrayFactory.HEAP, monitor.SuccessfulFactory); assertFalse(monitor.AttemptedAllocationFailures.GetEnumerator().hasNext()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldPickFirstAvailableCandidateIntArrayWhenSomeThrowNativeMemoryAllocationRefusedError() public virtual void ShouldPickFirstAvailableCandidateIntArrayWhenSomeThrowNativeMemoryAllocationRefusedError() { // GIVEN NumberArrayFactory lowMemoryFactory = mock(typeof(NumberArrayFactory)); doThrow(typeof(NativeMemoryAllocationRefusedError)).when(lowMemoryFactory).newIntArray(anyLong(), anyInt(), anyLong()); NumberArrayFactory factory = new NumberArrayFactory_Auto(NO_MONITOR, lowMemoryFactory, NumberArrayFactory.HEAP); // WHEN IntArray array = factory.NewIntArray(KILO, -1); array.Set(KILO - 10, 12345); // THEN verify(lowMemoryFactory, times(1)).newIntArray(KILO, -1, 0); assertTrue(array is HeapIntArray); assertEquals(12345, array.Get(KILO - 10)); }