Пример #1
0
        private static void Main(string[] args)
        {
            var sternOne   = new Stern(2);
            var sternTwo   = new Stern(4);
            var sternThree = new Stern(9);

            var stabOne = new Stab(sternOne, sternTwo, 9);
            var stabTwo = new Stab(stabOne, sternThree, 10);

            stabTwo.Balance();

            stabTwo.Print();
        }
Пример #2
0
        public void ValidateBalance_Case1()
        {
            var sternOne   = new Stern(2) as INode;
            var sternTwo   = new Stern(4) as INode;
            var sternThree = new Stern(9) as INode;

            var stabOne = new Stab(sternOne, sternTwo, 9) as INode;
            var stabTwo = new Stab(stabOne, sternThree, 10) as INode;

            stabTwo.Balance();

            stabTwo.Print();

            Assert.IsTrue(Math.Abs(((Stab)stabOne).Position - 6) < 0.05);
            Assert.IsTrue(Math.Abs(((Stab)stabTwo).Position - 6) < 0.05);
        }