public static void Reset() { // Arrange var value = new AnyT(); using var seq = new YieldForever <AnyT>(value); // Act IEnumerator it = seq.GetEnumerator(); // Assert for (int i = 0; i < 100; i++) { Assert.True(it.MoveNext()); Assert.Same(value, it.Current); } // Reset() does nothing. it.Reset(); for (int i = 0; i < 100; i++) { Assert.True(it.MoveNext()); Assert.Same(value, it.Current); } }
public static void Ident() { // Arrange var value = new AnyT(); // Act & Assert Assert.Same(Thunks <AnyT> .Ident, Thunks <AnyT> .Ident); Assert.NotNull(Thunks <AnyT> .Ident); Assert.Same(value, Thunks <AnyT> .Ident.Invoke(value)); }
public static void Current_Untyped() { // Arrange var value = new AnyT(); using var seq = new YieldForever <AnyT>(value); // Act IEnumerator it = seq.GetEnumerator(); // Assert // Even before the first MoveNext(), Current already returns "value". Assert.Same(value, it.Current); for (int i = 0; i < 100; i++) { Assert.True(it.MoveNext()); Assert.Same(value, it.Current); } }