Exemplo n.º 1
0
        public void SortDiamond()
        {
            var a = new C1Builder(this.Session).Build();
            var b = new C1Builder(this.Session).Build();
            var c = new C1Builder(this.Session).Build();
            var d = new C1Builder(this.Session).Build();

            a.AddDependency(b);
            a.AddDependency(c);

            b.AddDependency(d);
            c.AddDependency(d);

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

            var sequence = new List <IObject>();

            derivation["sequence"] = sequence;

            derivation.Derive();

            Assert.Equal(d, sequence[0]);
            Assert.Equal(a, sequence[3]);

            Assert.Equal(1, a.DerivationCount);
            Assert.Equal(1, b.DerivationCount);
            Assert.Equal(1, c.DerivationCount);
            Assert.Equal(1, d.DerivationCount);
        }
        public void SortDiamond()
        {
            var a = new C1Builder(this.Session).WithName("a").Build();
            var b = new C1Builder(this.Session).WithName("b").Build();
            var c = new C1Builder(this.Session).WithName("c").Build();
            var d = new C1Builder(this.Session).WithName("d").Build();

            a.AddDependency(b);
            a.AddDependency(c);

            b.AddDependency(d);
            c.AddDependency(d);

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

            var sequence = new List <IObject>();

            derivation["sequence"] = sequence;

            derivation.Derive();

            Assert.Equal(d, sequence[0]);
            Assert.Equal(a, sequence[3]);

            Assert.Equal(1, a.DerivationCount);
            Assert.Equal(1, b.DerivationCount);
            Assert.Equal(1, c.DerivationCount);
            Assert.Equal(1, d.DerivationCount);
        }
Exemplo n.º 3
0
        public void Sort()
        {
            var x = new C1Builder(this.Session).Build();
            var y = new C1Builder(this.Session).Build();
            var z = new C1Builder(this.Session).Build();

            x.AddDependency(y);
            y.AddDependency(z);

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

            var sequence = new List <IObject>();

            derivation["sequence"] = sequence;

            derivation.Derive();

            Assert.Equal(z, sequence[0]);
            Assert.Equal(y, sequence[1]);
            Assert.Equal(x, sequence[2]);

            Assert.Equal(1, x.DerivationCount);
            Assert.Equal(1, y.DerivationCount);
            Assert.Equal(1, z.DerivationCount);
        }
        public void Sort()
        {
            var x = new C1Builder(this.Session).Build();
            var y = new C1Builder(this.Session).Build();
            var z = new C1Builder(this.Session).Build();

            x.AddDependency(y);
            y.AddDependency(z);

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

            var sequence = new List <IObject>();

            derivation["sequence"] = sequence;

            derivation.Derive();

            Assert.Equal(z, sequence[0]);
            Assert.Equal(y, sequence[1]);
            Assert.Equal(x, sequence[2]);

            Assert.Equal(1, x.DerivationCount);
            Assert.Equal(1, y.DerivationCount);
            Assert.Equal(1, z.DerivationCount);
        }
Exemplo n.º 5
0
        public void SortDiamond()
        {
            var a = new C1Builder(this.DatabaseSession).Build();
            var b = new C1Builder(this.DatabaseSession).Build();
            var c = new C1Builder(this.DatabaseSession).Build();
            var d = new C1Builder(this.DatabaseSession).Build();

            a.AddDependency(b);
            a.AddDependency(c);

            b.AddDependency(d);
            c.AddDependency(d);

            var derivation = new Derivation(this.DatabaseSession);

            var sequence = new List<IObject>();
            derivation["sequence"] = sequence;

            derivation.Derive();

            Assert.AreEqual(d, sequence[0]);
            Assert.AreEqual(a, sequence[3]);
        }
        public void SortDiamond()
        {
            var a = new C1Builder(this.Session).Build();
            var b = new C1Builder(this.Session).Build();
            var c = new C1Builder(this.Session).Build();
            var d = new C1Builder(this.Session).Build();

            a.AddDependency(b);
            a.AddDependency(c);

            b.AddDependency(d);
            c.AddDependency(d);

            var derivation = new Derivation(this.Session);

            var sequence = new List <IObject>();

            derivation["sequence"] = sequence;

            derivation.Derive();

            Assert.AreEqual(d, sequence[0]);
            Assert.AreEqual(a, sequence[3]);
        }
Exemplo n.º 7
0
        public void Sort()
        {
            var x = new C1Builder(this.DatabaseSession).Build();
            var y = new C1Builder(this.DatabaseSession).Build();
            var z = new C1Builder(this.DatabaseSession).Build();

            x.AddDependency(y);
            y.AddDependency(z);

            var derivation = new Derivation(this.DatabaseSession);

            var sequence = new List<IObject>();
            derivation["sequence"] = sequence;

            derivation.Derive();

            Assert.AreEqual(z, sequence[0]);
            Assert.AreEqual(y, sequence[1]);
            Assert.AreEqual(x, sequence[2]);
        }
        public void Sort()
        {
            var x = new C1Builder(this.Session).Build();
            var y = new C1Builder(this.Session).Build();
            var z = new C1Builder(this.Session).Build();

            x.AddDependency(y);
            y.AddDependency(z);

            var derivation = new Derivation(this.Session);

            var sequence = new List <IObject>();

            derivation["sequence"] = sequence;

            derivation.Derive();

            Assert.AreEqual(z, sequence[0]);
            Assert.AreEqual(y, sequence[1]);
            Assert.AreEqual(x, sequence[2]);
        }