public void ClearTest() { var emptyQueue = ImmutableQueue.Create <GenericParameterHelper>(); AssertAreSame(emptyQueue, emptyQueue.Clear()); var nonEmptyQueue = emptyQueue.Enqueue(new GenericParameterHelper(3)); AssertAreSame(emptyQueue, nonEmptyQueue.Clear()); // Interface test IImmutableQueue <GenericParameterHelper> queueInterface = nonEmptyQueue; AssertAreSame(emptyQueue, queueInterface.Clear()); }
public void TestClear() { ImmutableTreeQueue <int> queue = ImmutableTreeQueue <int> .Empty; Assert.Same(queue, queue.Clear()); foreach (int item in Enumerable.Range(0, 10)) { queue = queue.Enqueue(item); } Assert.NotEmpty(queue); Assert.Same(ImmutableTreeQueue <int> .Empty, queue.Clear()); // Test through the IImmutableQueue<T> interface IImmutableQueue <int> immutableQueue = queue; Assert.NotEmpty(immutableQueue); Assert.Same(ImmutableTreeQueue <int> .Empty, immutableQueue.Clear()); }
public static IImmutableQueue <T> clear <T>(IImmutableQueue <T> queue) => queue.Clear();