예제 #1
0
        public void RemovePairTest()
        {
            PromiseCollection <int> collection = GetCollection();

            Assert.IsTrue(collection.Remove(new KeyValuePair <string, IPromise <int> >("first", collection["first"])));
            Assert.AreEqual(0, collection.Count);
        }
예제 #2
0
        public void RemoveTest()
        {
            PromiseCollection <int> collection = GetCollection();

            Assert.IsTrue(collection.Remove("first"));
            Assert.AreEqual(0, collection.Count);
        }
예제 #3
0
        private PromiseCollection <int> GetCollection()
        {
            PromiseCollection <int> collection = new PromiseCollection <int>();

            collection.Add(new KeyValuePair <string, IPromise <int> >("first", new Promise <int>()));
            return(collection);
        }
예제 #4
0
        public void ClearTest()
        {
            PromiseCollection <int> collection = GetCollection();

            collection.Clear();
            Assert.AreEqual(0, collection.Count);
        }
예제 #5
0
        public void AddTest()
        {
            PromiseCollection <int> collection = new PromiseCollection <int>();

            collection.Add("first", new Promise <int>());
            Assert.AreEqual(1, collection.Count);
        }
예제 #6
0
        public void CopyToTest()
        {
            PromiseCollection <int> collection = GetCollection();

            KeyValuePair <string, IPromise <int> >[] array = new KeyValuePair <string, IPromise <int> > [1];
            collection.CopyTo(array, 0);
            Assert.AreEqual(collection.First(), array.First());
        }
예제 #7
0
        public void RemoveAndGetTest()
        {
            PromiseCollection <int> collection = GetCollection();
            var pr = collection.RemoveAndGet("first");

            Assert.IsInstanceOfType(pr, typeof(IPromise <int>));
            Assert.AreEqual(0, collection.Count);
        }
예제 #8
0
        public void GetEnumeratorTest()
        {
            PromiseCollection <int> collection = GetCollection();
            var obj = collection.GetEnumerator() as IEnumerator <KeyValuePair <string, IPromise <int> > >;

            Assert.IsNotNull(obj);
            IEnumerable e = collection;

            Assert.IsInstanceOfType(e.GetEnumerator(), typeof(IEnumerator));
        }
예제 #9
0
        public void IndexerTest()
        {
            PromiseCollection <int> collection = GetCollection();

            collection["second"] = new Promise <int>();
            var pr = collection["first"];

            Assert.IsInstanceOfType(pr, typeof(IPromise <int>));
            Assert.AreEqual(2, collection.Count);
        }
예제 #10
0
        public void ContainsKeyTest()
        {
            PromiseCollection <int> collection = GetCollection();

            Assert.IsTrue(collection.ContainsKey("first"));
        }
예제 #11
0
        public void ContainsTest()
        {
            PromiseCollection <int> collection = GetCollection();

            Assert.IsTrue(collection.Contains(new KeyValuePair <string, IPromise <int> >("first", collection["first"])));
        }
예제 #12
0
        public void AddPairTest()
        {
            PromiseCollection <int> collection = GetCollection();

            Assert.AreEqual(1, collection.Count);
        }
예제 #13
0
        public void NotFoundExceptionTest()
        {
            PromiseCollection <int> collection = new PromiseCollection <int>();

            Assert.ThrowsException <Exception>(() => collection["f"]);
        }