//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test void shouldContainAddedValues_generated_1() internal virtual void ShouldContainAddedValuesGenerated_1() { // GIVEN PrimitiveLongSet set = NewSet(15); ISet <long> expectedValues = new HashSet <long>(); long[] valuesToAdd = new long[] { 1207043189, 380713862, 1902858197, 1996873101, 1357024628, 1044248801, 1558157493, 2040311008, 2017660098, 1332670047, 663662790, 2063747422, 1554358949, 1761477445, 1141526838, 1698679618, 1279767067, 508574, 2071755904 }; foreach (long key in valuesToAdd) { set.Add(key); expectedValues.Add(key); } // WHEN/THEN bool existedBefore = set.Contains(679990875); bool added = set.Add(679990875); bool existsAfter = set.Contains(679990875); assertFalse(existedBefore, "679990875 should not exist before adding here"); assertTrue(added, "679990875 should be reported as added here"); assertTrue(existsAfter, "679990875 should exist"); expectedValues.Add(679990875L); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final java.util.Set<long> visitedKeys = new java.util.HashSet<>(); ISet <long> visitedKeys = new HashSet <long>(); set.VisitKeys(value => { assertTrue(visitedKeys.Add(value)); return(false); }); assertEquals(expectedValues, visitedKeys); }
private static void AssertQueryResultsMatch(ScoreEntityIterator result, long[] ids) { PrimitiveLongSet set = PrimitiveLongCollections.setOf(ids); while (result.MoveNext()) { long next = result.Current.entityId(); assertTrue(format("Result returned node id %d, expected one of %s", next, Arrays.ToString(ids)), set.Remove(next)); } if (!set.Empty) { IList <long> list = new List <long>(); set.VisitKeys(k => !list.Add(k)); fail("Number of results differ from expected. " + set.Size() + " IDs were not found in the result: " + list); } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") @Test void longVisitorShouldSeeAllEntriesIfItDoesNotBreakOut() internal virtual void LongVisitorShouldSeeAllEntriesIfItDoesNotBreakOut() { // GIVEN PrimitiveLongSet set = Primitive.longSet(); set.Add(1); set.Add(2); set.Add(3); PrimitiveLongVisitor <Exception> visitor = mock(typeof(PrimitiveLongVisitor)); // WHEN set.VisitKeys(visitor); // THEN verify(visitor).visited(1); verify(visitor).visited(2); verify(visitor).visited(3); verifyNoMoreInteractions(visitor); }