//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldInstantiateLazilyOnFirstSelect() public virtual void ShouldInstantiateLazilyOnFirstSelect() { // given System.Func <IndexSlot, string> factory = SlotToStringFunction(); LazyInstanceSelector <string> selector = new LazyInstanceSelector <string>(factory); // when foreach (IndexSlot slot in values()) { foreach (IndexSlot candidate in values()) { // then if (( int )candidate < ( int )slot) { verify(factory, times(1)).apply(candidate); selector.Select(candidate); verify(factory, times(1)).apply(candidate); } else if (candidate == slot) { verify(factory, times(0)).apply(candidate); selector.Select(candidate); verify(factory, times(1)).apply(candidate); } else { assertNull(selector.GetIfInstantiated(candidate)); } } } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldCloseAllInstantiated() public virtual void ShouldCloseAllInstantiated() { // given System.Func <IndexSlot, string> factory = SlotToStringFunction(); LazyInstanceSelector <string> selector = new LazyInstanceSelector <string>(factory); selector.Select(NUMBER); selector.Select(STRING); // when System.Action <string> consumer = mock(typeof(System.Action)); selector.Close(consumer); // then verify(consumer, times(1)).accept(NUMBER.ToString()); verify(consumer, times(1)).accept(STRING.ToString()); verifyNoMoreInteractions(consumer); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldPerformActionOnAll() public virtual void ShouldPerformActionOnAll() { // given System.Func <IndexSlot, string> factory = SlotToStringFunction(); LazyInstanceSelector <string> selector = new LazyInstanceSelector <string>(factory); selector.Select(STRING); // when System.Action <string> consumer = mock(typeof(System.Action)); selector.ForAll(consumer); // then foreach (IndexSlot slot in Enum.GetValues(typeof(IndexSlot))) { verify(consumer, times(1)).accept(slot.ToString()); } verifyNoMoreInteractions(consumer); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldPreventInstantiationAfterClose() public virtual void ShouldPreventInstantiationAfterClose() { // given System.Func <IndexSlot, string> factory = SlotToStringFunction(); LazyInstanceSelector <string> selector = new LazyInstanceSelector <string>(factory); selector.Select(NUMBER); selector.Select(STRING); // when selector.Close(mock(typeof(System.Action))); // then try { selector.Select(TEMPORAL); fail("Should have failed"); } catch (System.InvalidOperationException) { // then good } }
internal FusionIndexReader(SlotSelector slotSelector, LazyInstanceSelector <IndexReader> instanceSelector, IndexDescriptor descriptor) : base(slotSelector, instanceSelector) { this._descriptor = descriptor; }
internal FusionIndexUpdater(SlotSelector slotSelector, LazyInstanceSelector <IndexUpdater> instanceSelector) : base(slotSelector, instanceSelector) { }
public override IndexReader NewReader() { LazyInstanceSelector <IndexReader> readerSelector = new LazyInstanceSelector <IndexReader>(slot => InstanceSelector.select(slot).newReader()); return(new FusionIndexReader(SlotSelector, readerSelector, _descriptor)); }
public override IndexUpdater NewUpdater(IndexUpdateMode mode) { LazyInstanceSelector <IndexUpdater> updaterSelector = new LazyInstanceSelector <IndexUpdater>(slot => InstanceSelector.select(slot).newUpdater(mode)); return(new FusionIndexUpdater(SlotSelector, updaterSelector)); }
public override IndexUpdater NewPopulatingUpdater(NodePropertyAccessor accessor) { LazyInstanceSelector <IndexUpdater> updaterSelector = new LazyInstanceSelector <IndexUpdater>(slot => InstanceSelector.select(slot).newPopulatingUpdater(accessor)); return(new FusionIndexUpdater(SlotSelector, updaterSelector)); }