Example #1
0
        public void SafeHashSet依照帶入參數執行聯集操作_執行成功_結果應是SafeHashSet與參數的聯集()
        {
            var safeHashSet = new SafeHashSet <int> {
                1, 2, 3
            };
            var param = Enumerable.Range(0, 5);

            safeHashSet.UnionWith(param);
            var expectedResult = new List <int> {
                1, 2, 3, 0, 4
            };

            safeHashSet.SequenceEqual(expectedResult).Should().Be(true);
        }
Example #2
0
        public void SafeHashSet依照帶入參數執行差集操作_執行成功_結果應是SafeHashSet與參數的差集()
        {
            var safeHashSet = new SafeHashSet <int> {
                1, 2, 3, 4, 5
            };
            var param = Enumerable.Range(0, 10).Where(x => x % 2 == 0);

            safeHashSet.ExceptWith(param);
            var expectedResult = new List <int> {
                1, 3, 5
            };

            safeHashSet.SequenceEqual(expectedResult).Should().Be(true);
        }