Ejemplo n.º 1
0
        public void LinearAddressTest()
        {
            var par1 = new Parameter("par1", 0, 4, 1);
            var par2 = new Parameter("par2", 0, 4, 1);
            var pars = new RefList <Parameter>();

            pars.Add(par1);
            pars.Add(par2);
            //var pars = new Parameters();

            pars.Ref(0).CurrentPosition = 1;
            pars.Ref(1).CurrentPosition = 0;

            Assert.AreEqual(5, pars.LinearAddress());

            pars.Ref(1).CurrentPosition = 1;

            Assert.AreEqual(6, pars.LinearAddress());

            pars.Ref(0).CurrentPosition = 4;
            pars.Ref(1).CurrentPosition = 3;
            Assert.AreEqual(23, pars.LinearAddress());

            var pars2 = pars.SetPositionsFromLinearAddress(23);

            Assert.AreEqual(4, pars2[0].CurrentPosition);
            Assert.AreEqual(3, pars2[1].CurrentPosition);
        }