public void EnumeratorWithEntryVar() { Assert.AreEqual(activeSites.Count, map.Count); LocationAndIndex myEntry = new LocationAndIndex(); ActiveSiteMapEnumerator mapEtor = map.GetEnumerator(); System.Type type = typeof(ActiveSiteMapEnumerator); MethodInfo useForCurrentEntryMethodInfo = type.GetMethod("UseForCurrentEntry", BindingFlags.Instance | BindingFlags.NonPublic); useForCurrentEntryMethodInfo.Invoke(mapEtor, new object[] { myEntry }); int index = 0; while (mapEtor.MoveNext()) { index++; Assert.IsTrue(index <= map.Count); Assert.AreSame(myEntry, mapEtor.Current); Assert.AreEqual(index, myEntry.Index); Assert.AreEqual(activeSites[index - 1], myEntry.Location); } Assert.AreEqual(map.Count, index); }
public void EnumeratorWithEntryVar() { Assert.AreEqual(activeSites.Count, map.Count); LocationAndIndex myEntry = new LocationAndIndex(); ActiveSiteMapEnumerator mapEtor = map.GetEnumerator(); mapEtor.UseForCurrentEntry(myEntry); int index = 0; while (mapEtor.MoveNext()) { Assert.IsTrue(index < map.Count); Assert.AreSame(myEntry, mapEtor.Current); Assert.AreEqual(index, myEntry.Index); Assert.AreEqual(activeSites[index], myEntry.Location); index++; } Assert.AreEqual(map.Count, index); }