예제 #1
0
        public void CreateOldCamera()
        {
            var device = DeviceFactory.CreateDevice("OldCamera", "my old camera");
            var camera = new OldCamera("my old camera", new OldCameraCommChannel());

            //check name
            Assert.Equal(camera.Name, device.Name);
            //check type
            Assert.Equal(camera.GetType(), device.GetType());
            //check status
            Assert.Equal(camera.CheckStatus(), device.CheckStatus());
            //check Connection
            Assert.Equal(camera.CheckConnection(), device.CheckConnection());
        }
예제 #2
0
        public override void Execute()
        {
            //check connection first
            if (!_device.CheckConnection())
            {
                _device.Connect();
            }
            //check status
            if (!_device.CheckStatus())
            {
                return;
            }

            _device.TurnOff();
        }