Example #1
0
        public void 複製SafeHashSet至指定陣列_複製成功_複製結果應與原集合相同()
        {
            var       fixure      = new Fixture();
            var       safeHashSet = new SafeHashSet <int>();
            const int count       = 10;

            safeHashSet.AddMany(fixure.Create <int>, count);
            var result = new int[count];

            safeHashSet.CopyTo(result, 0);
            result.Should().BeEquivalentTo(safeHashSet);
        }
Example #2
0
        public void 繞行SafeHashSet_繞行完成_繞行結果應該與原集合相同()
        {
            var       fixure      = new Fixture();
            var       safeHashSet = new SafeHashSet <int>();
            const int count       = 10;

            safeHashSet.AddMany(fixure.Create <int>, count);
            var result = new List <int>();

            foreach (var x in safeHashSet)
            {
                result.Add(x);
            }
            result.Should().BeEquivalentTo(safeHashSet);
        }