Esempio n. 1
0
        public void SideGearTakesCloseTo2s8ToOpen()
        {
            var sideGear = new SideGear("Right", Cylinder.Targets.Gears);


            sideGear.Retract();

            while (!(sideGear.Is_Locked && sideGear.Gear_retracted))
            {
            }

            sideGear.StopRetract();

            var start = DateTime.Now;

            sideGear.Extend();

            while (!(sideGear.Is_Locked && sideGear.Gear_Extended))
            {
            }
            var end      = DateTime.Now;
            var dif      = end - start;
            var expected = 2.8;

            var variation = Math.Abs((dif.TotalSeconds - expected) / expected);

            Assert.LessOrEqual(variation, 0.2);
        }
        public void WhenPressureIsOkUpCommandLiftCylinders()
        {
            GlobalValve generalValve = new GlobalValve();
            var         module       = new ComputingModule(generalValve);

            ElectroValve valveGearClose = new ElectroValve(ElectroValve.Targets.Gears, ElectroValve.Types.Retraction, false);
            ElectroValve valveGearOpen  = new ElectroValve(ElectroValve.Targets.Gears, ElectroValve.Types.Extension, false);
            ElectroValve valveDoorClose = new ElectroValve(ElectroValve.Targets.Doors, ElectroValve.Types.Retraction, false);
            ElectroValve valveDoorOpen  = new ElectroValve(ElectroValve.Targets.Doors, ElectroValve.Types.Extension, false);

            module.GetValvesFromGeneral();

            generalValve.Valves.Add(valveDoorOpen);
            generalValve.Valves.Add(valveDoorClose);
            generalValve.Valves.Add(valveGearClose);
            generalValve.Valves.Add(valveGearOpen);

            var frontGear = new FrontGear("Front", Cylinder.Targets.Gears);
            var leftGear  = new SideGear("Left", Cylinder.Targets.Gears);
            var rightGear = new SideGear("Right", Cylinder.Targets.Gears);

            valveGearClose.Cylinders.Add(frontGear);
            valveGearClose.Cylinders.Add(leftGear);
            valveGearClose.Cylinders.Add(rightGear);
            valveGearOpen.Cylinders.Add(frontGear);
            valveGearOpen.Cylinders.Add(leftGear);
            valveGearOpen.Cylinders.Add(rightGear);

            var frontDoor = new FrontDoor("Front", Cylinder.Targets.Doors);
            var leftDoor  = new SideDoor("Left", Cylinder.Targets.Doors);
            var rightDoor = new SideDoor("Right", Cylinder.Targets.Doors);

            valveDoorClose.Cylinders.Add(frontDoor);
            valveDoorClose.Cylinders.Add(leftDoor);
            valveDoorClose.Cylinders.Add(rightDoor);
            valveDoorOpen.Cylinders.Add(frontDoor);
            valveDoorOpen.Cylinders.Add(leftDoor);
            valveDoorOpen.Cylinders.Add(rightDoor);

            valveDoorOpen.Cylinders.ForEach(c => module.CylinderAdd(c));
            valveGearOpen.Cylinders.ForEach(c => module.CylinderAdd(c));

            //make the plane fly
            valveGearOpen.Cylinders.ForEach(c => c.OnFloor = false);

            module.Up();

            System.Threading.Thread.Sleep(10000);
        }
Esempio n. 3
0
        public void SideGearTakesCloseTo3s2ToClose()
        {
            var sideGear = new SideGear("Left", Cylinder.Targets.Gears);

            var start = DateTime.Now;

            sideGear.Retract();

            while (!(sideGear.Is_Locked && sideGear.Gear_retracted))
            {
            }
            var end = DateTime.Now;

            var dif      = end - start;
            var expected = 3.2;

            var variation = Math.Abs((dif.TotalSeconds - expected) / expected);

            Assert.LessOrEqual(variation, 0.2);
        }