コード例 #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"]);
        }