예제 #1
0
        public void When_copying_values()
        {
            var p1 = new Person("A", 1);
            var p2 = new Person("B", 2);

            EasyDictionary <string, Person> dic = new EasyDictionary <string, Person>(p => p.Id)
            {
                p1,
                p2
            };

            dic.Count.ShouldBe(2);

            var copy = new Person[3];

            dic.CopyTo(copy, 1);

            copy.Length.ShouldBe(3);
            copy[0].ShouldBeNull();

            copy[1].ShouldBe(p1);
            copy[2].ShouldBe(p2);
        }