// ----------------------------------------------------------------------- // // TODO: Update copyright text. // // ----------------------------------------------------------------------- using System.Collections.Concurrent; using NUnit.Framework; namespace Pithos.Core.Test { using System; using System.Collections.Generic; using System.Linq; using System.Text; [TestFixture] public class TaskExtensionsTest { [Test] public void when_adding_to_ObservableConcurrentCollection() { var collection = new ObservableConcurrentCollection(); collection.TryAdd("1"); Assert.That(collection,Contains.Item("1")); collection.TryAdd("2"); Assert.That(collection, Contains.Item("2")); Assert.That(collection, Contains.Item("1")); } [Test] public void when_removing_from_ObservableConcurrentCollection() { var collection = new ObservableConcurrentCollection(); collection.TryAdd("1"); collection.TryAdd("2"); collection.TryAdd("3"); collection.TryRemove("2"); Assert.That(collection, Contains.Item("1")); Assert.That(collection.Contains("2"), Is.False); Assert.That(collection, Contains.Item("3")); } } }