Example #1
0
        public void changeTrackingService_using_beginAtomicOperation_getEntities_should_return_all_transient_entities()
        {
            var target = new ChangeTrackingService();

            var list   = new PersonCollection(target);
            var person = new Person(target, false);

            using (var op = target.BeginAtomicOperation())
            {
                target.RegisterTransient(person);
                person.Name = "Mauro";
                list.Add(person);
                person.Name = "Mauro Servienti";

                op.Complete();
            }

            var actual = target.GetEntities(EntityTrackingStates.IsTransient, false);

            actual.Contains(person).Should().Be.True();
        }
Example #2
0
        public void changeTrackingService_using_beginAtomicOperation_getEntities_should_return_all_changed_entities()
        {
            var target = new ChangeTrackingService();

            var person = new Person(target);
            var list   = new PersonCollection(target);

            using (var op = target.BeginAtomicOperation())
            {
                person.Name = "Mauro";
                list.Add(person);
                person.Name = "Mauro Servienti";

                op.Complete();
            }

            var actual = target.GetEntities(EntityTrackingStates.HasBackwardChanges, false);

            /*
             * Non funziona perchè non funziona GetEntityState()
             */

            actual.Contains(person).Should().Be.True();
        }