Statistics
| Branch: | Revision:

root / trunk / Pithos.Core.Test / TaskExtensionsTest.cs @ 7f5882da

History | View | Annotate | Download (1.4 kB)

1
// -----------------------------------------------------------------------
2
// <copyright file="TaskExtensionsTest.cs" company="Microsoft">
3
// TODO: Update copyright text.
4
// </copyright>
5
// -----------------------------------------------------------------------
6

    
7
using System.Collections.Concurrent;
8
using NUnit.Framework;
9

    
10
namespace Pithos.Core.Test
11
{
12
    using System;
13
    using System.Collections.Generic;
14
    using System.Linq;
15
    using System.Text;
16

    
17
    [TestFixture]
18
    public class TaskExtensionsTest
19
    {
20
        [Test]
21
        public void when_adding_to_ObservableConcurrentCollection()
22
        {
23
            var collection = new ObservableConcurrentCollection<string>();
24
            collection.TryAdd("1");
25
            Assert.That(collection,Contains.Item("1"));
26
            collection.TryAdd("2");
27
            Assert.That(collection, Contains.Item("2"));
28
            Assert.That(collection, Contains.Item("1"));
29
            
30
        }
31

    
32
        [Test]
33
        public void when_removing_from_ObservableConcurrentCollection()
34
        {
35
            var collection = new ObservableConcurrentCollection<string>();
36
            collection.TryAdd("1");
37
            collection.TryAdd("2");
38
            collection.TryAdd("3");
39
            collection.TryRemove("2");
40
            Assert.That(collection, Contains.Item("1"));
41
            Assert.That(collection.Contains("2"), Is.False);
42
            Assert.That(collection, Contains.Item("3"));
43
            
44
        }
45
    }
46
}