public void TryAddMaximum() { //**************************************** var MyCollection = new AsyncCollection <int>(1); //**************************************** _ = MyCollection.TryAdd(42); //**************************************** Assert.IsFalse(MyCollection.TryAdd(84), "Add unexpectedly succeeded"); }
public void TryAdd() { //**************************************** var MyCollection = new AsyncCollection <int>(); //**************************************** Assert.IsTrue(MyCollection.TryAdd(42), "Failed to add"); }
public void TryPeekSuccess() { //**************************************** var MyCollection = new AsyncCollection <int>(); //**************************************** _ = MyCollection.TryAdd(42); Assert.IsTrue(MyCollection.TryPeek(), "Peek failed unexpectedly"); }
public void TryAddCompleted() { //**************************************** var MyCollection = new AsyncCollection <int>(1); //**************************************** _ = MyCollection.CompleteAdding(); //**************************************** Assert.IsFalse(MyCollection.TryAdd(42), "Add unexpectedly succeeded"); }
public void PeekSuccess() { //**************************************** var MyCollection = new AsyncCollection <int>(); //**************************************** _ = MyCollection.TryAdd(42); var MyTask = MyCollection.Peek(); //**************************************** Assert.IsTrue(MyTask.IsCompleted, "Peek failed unexpectedly"); }