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

            safeDictionary.AddMany(fixture.Create <KeyValuePair <int, int> >, 3);
            var array = new KeyValuePair <int, int> [3];

            safeDictionary.CopyTo(array, 0);
            array.SequenceEqual(safeDictionary).Should().Be(true);
        }
コード例 #2
0
        public void 繞行SafeDictionary的Values_繞行成功_繞行結果需與原本集合相同()
        {
            var safeDictionary = new SafeDictionary <int, int>();
            var fixture        = new Fixture();

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

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