Esempio n. 1
0
        public void 取得SafeHashSet是否包含指定元素_SafeHashSet包含該元素_應回傳True()
        {
            var safeHashSet = new SafeHashSet <int> {
                0, 1, 2, 3, 4, 5
            };
            var result = safeHashSet.Contains(3);

            result.Should().Be(true);
        }
Esempio n. 2
0
        public void 取得SafeHashSet是否包含指定元素_SafeHashSet不包含該元素_應回傳False()
        {
            var safeHashSet = new SafeHashSet <int> {
                0, 1, 2, 3, 4, 5
            };
            var result = safeHashSet.Contains(10);

            result.Should().Be(false);
        }
Esempio n. 3
0
        /// <summary>
        ///Contains 的测试
        ///</summary>
        public void ContainsTestHelper <KeyT>()
        {
            SafeHashSet <KeyT> target = new SafeHashSet <KeyT>(); // TODO: 初始化为适当的值
            KeyT key      = default(KeyT);                        // TODO: 初始化为适当的值
            bool expected = false;                                // TODO: 初始化为适当的值
            bool actual;

            actual = target.Contains(key);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("验证此测试方法的正确性。");
        }
Esempio n. 4
0
        public void 移除SafeHashSet指定元素_移除成功_集合應不包含該元素並回傳True()
        {
            var safeHashSet = new SafeHashSet <int> {
                0, 1, 2, 3, 4, 5
            };
            const int target = 4;
            var       result = safeHashSet.Remove(target);

            result.Should().Be(true);
            var isContain = safeHashSet.Contains(target);

            isContain.Should().Be(false);
        }
Esempio n. 5
0
        public void SafeHashSet依照加入指定元素_集合中已經包含該元素故加入失敗_SafeHashSet應包含該元素並應回傳False()
        {
            var safeHashSet = new SafeHashSet <int> {
                0, 1, 2, 3, 4, 5
            };
            const int element = 3;
            var       result  = safeHashSet.Add(element);

            result.Should().Be(false);
            var isContain = safeHashSet.Contains(element);

            isContain.Should().Be(true);
        }
Esempio n. 6
0
        public void SafeHashSet依照加入指定元素_加入成功_SafeHashSet應包含該元素並回傳True()
        {
            var safeHashSet = new SafeHashSet <int> {
                0, 1, 2, 3, 4, 5
            };
            const int element = 10;
            var       result  = safeHashSet.Add(element);

            result.Should().Be(true);
            var isContain = safeHashSet.Contains(element);

            isContain.Should().Be(true);
        }
Esempio n. 7
0
 /// <summary> Checks whether element with specific id is registered. </summary>
 /// <param name="id"> Element id. </param>
 /// <returns> True if registration is found. </returns>
 public bool Has(long id)
 {
     return(GlobalIds.Contains(id) || _localIds.Contains(id));
 }
Esempio n. 8
0
 /// <summary> Checks whether element with specific id is registered. </summary>
 /// <param name="id">Element id.</param>
 /// <returns> True if registration is found. </returns>
 internal bool Has(long id)
 {
     return(GlobalIds.Contains(id) || _localIds.Contains(id));
 }