Пример #1
0
        public void changeTrackingService_using_beginAtomicOperation_hasTransientEntities_should_return_true_even_for_entities_created_in_the_atomic_operation()
        {
            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.HasTransientEntities;

            actual.Should().Be.True();
        }
Пример #2
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();
        }