コード例 #1
0
        public void 拷貝SafeCollection_從Index0開始拷貝_拷貝的結果應該與SafList相同()
        {
            var safeCollection = new SafeCollection <int>();
            var fixture        = new Fixture();

            safeCollection.AddMany(fixture.Create <int>, 10);
            var array = new int[10];

            safeCollection.CopyTo(array, 0);
            array.Should().BeEquivalentTo(safeCollection);
        }
コード例 #2
0
        public void 繞行SafeCollection_繞行成功_繞行結果需與原本集合相同()
        {
            var safeCollection = new SafeCollection <int>();
            var fixture        = new Fixture();

            safeCollection.AddMany(fixture.Create <int>, 10);
            var result = new Collection <int>();

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