public virtual async Task <Todo[]> List(Session session, PageRef <string> pageRef, CancellationToken cancellationToken = default) { await PseudoGetAllItems(session); var todos = _store.AsEnumerable(); if (pageRef.AfterKey != null) { todos = todos.Where(i => string.CompareOrdinal(i.Id, pageRef.AfterKey) > 0); } todos = todos.Take(pageRef.Count); return(todos.ToArray()); }
public void Returns_Enumerable() { // Arrange var i0 = Rnd.Int; var i1 = Rnd.Int; var list = new ImmutableList <int>(new[] { i0, i1 }); // Act var result = list.AsEnumerable(); // Assert Assert.IsAssignableFrom <IEnumerable <int> >(result); Assert.Collection(result, x => Assert.Equal(i0, x), x => Assert.Equal(i1, x) ); }
public void Returns_Copy() { // Arrange var i0 = Rnd.Str; var i1 = Rnd.Str; var list = new ImmutableList <string>(new[] { i0, i1 }); // Act var copy = list.AsEnumerable(); i0 = Rnd.Str; i1 = Rnd.Str; // Assert Assert.Collection(copy, x => Assert.NotEqual(i0, x), x => Assert.NotEqual(i1, x) ); }
public override string ToString() { var sb = new StringBuilder(); sb.AppendLine("\tViewId: " + _viewId); sb.AppendLine("\tLeaderId: " + _leaderId); if (_members.Count > 0) { sb.AppendLine("\tMembers: "); foreach (var nodeRemoteInfo in _members.AsEnumerable()) { sb.Append("\t"); sb.AppendLine(nodeRemoteInfo.ToString()); } } if (_leavers.Count > 0) { sb.AppendLine("\tLeavers: "); foreach (var nodeRemoteInfo in _leavers.AsEnumerable()) { sb.Append("\t"); sb.AppendLine(nodeRemoteInfo.ToString()); } } if (_joiners.Count > 0) { sb.AppendLine("\tJoiners: "); foreach (var nodeRemoteInfo in _joiners.AsEnumerable()) { sb.Append("\t"); sb.AppendLine(nodeRemoteInfo.ToString()); } } return(sb.ToString()); }
/// <summary> /// Put some siblings next to each other. /// </summary> public static Html _(ImmutableList <Html> siblings) => _(siblings.AsEnumerable());
/// <summary> /// Create a tag without any attributes. /// </summary> public static Html Tag_(string name, ImmutableList <Html> children) => Tag_(name, children.AsEnumerable());
/// <summary> /// Add children to the tag. /// </summary> /// <returns>An instance of <see cref="Html"/></returns> public Html _(ImmutableList <Html> children) => _(children.AsEnumerable());
public IEnumerator <T> GetEnumerator() { return(_source.AsEnumerable().GetEnumerator()); }