Пример #1
0
        public void service_on_clear_undo_entities_are_restored()
        {
            var source = new Person[]
            {
                new Person(null, false),
                new Person(null, false),
                new Person(null, false),
                new Person(null, false),
                new Person(null, false)
            };

            ChangeTrackingService svc = new ChangeTrackingService();

            PersonCollection list = new PersonCollection(svc);

            list.BeginInit();
            list.AddRange(source);
            list.EndInit();

            list.Clear();
            svc.Undo();

            Assert.AreEqual <int>(source.Length, list.Count());
            source.ForEach(p =>
            {
                int expected = Array.IndexOf(source, p);
                int actual   = list.IndexOf(p);

                Assert.AreEqual <int>(expected, actual);
            });
        }