Пример #1
0
        public void NoCyclicDependencyDuringSyncExisting()
        {
            var syncRoot = new SyncRootBuilder(this.Session).Build();

            this.Session.Derive();
            this.Session.Commit();

            var errorThrown = false;

            syncRoot.SyncDepth1.SyncDepth2.Value = 1;

            var derivation = new Derivation(this.Session, new DerivationConfig {
                ThrowExceptionOnCycleDetected = true
            });

            try
            {
                derivation.Derive();
            }
            catch (Exception)
            {
                errorThrown = true;
            }

            Assert.False(errorThrown);

            Assert.Equal(2, syncRoot.DerivationCount);
            Assert.Equal(2, syncRoot.SyncDepth1.DerivationCount);
            Assert.Equal(2, syncRoot.SyncDepth1.SyncDepth2.DerivationCount);
        }
        public void NoCyclicDependencyDuringSyncCreate()
        {
            var syncRoot = new SyncRootBuilder(this.Session).Build();

            var errorThrown = false;

            var derivation = this.DerivationService.CreateDerivation(this.Session);

            try
            {
                derivation.Derive();
            }
            catch (Exception)
            {
                errorThrown = true;
            }

            Assert.False(errorThrown);

            Assert.Equal(1, syncRoot.DerivationCount);
            Assert.Equal(1, syncRoot.SyncDepth1.DerivationCount);
            Assert.Equal(1, syncRoot.SyncDepth1.SyncDepth2.DerivationCount);
        }