Exemplo n.º 1
0
        public void RemoveTest()
        {
            EntityGraphTestsDomainContext ctx    = new EntityGraphTestsDomainContext();
            LoadOperation <B>             loadOp = ctx.Load(ctx.GetBSetQuery());

            EnqueueConditional(() => loadOp.IsComplete);
            EnqueueCallback(
                () =>
            {
                EntityGraph gr = a.EntityGraph(EntityGraphs.CircularGraphFull);
                B existingB    = ctx.Bs.Single();
                ctx.As.Add(a);
                a.BSet.Add(new B());
                a.BSet.Add(existingB);
                gr.RemoveEntityGraph(ctx.As);

                var changeSet = ctx.EntityContainer.GetChanges();
                Assert.IsTrue(changeSet.AddedEntities.Count() == 0, "Added entities should be zero");
                Assert.IsTrue(changeSet.RemovedEntities.Count() == 2, "Removed entities should be 2");
            });
            EnqueueTestComplete();
        }