public void CatchShootExceptionTest()
        {
            ShootingException exception = new ShootingException();

            IImageHandler    imageHandler = (IImageHandler)_mockery.NewMock(typeof(IImageHandler));
            IShootParameters parameters   = (IShootParameters)_mockery.NewMock(typeof(IShootParameters));

            Expect.Once.On(_camera).Method("LockUI").WithNoArguments();
            Expect.Once.On(parameters).Method("ApplyTo").With(_camera);
            Expect.Once.On(_camera).Method("Shoot").WithNoArguments().Will(Throw.Exception(exception));
            Expect.Once.On(_camera).Method("UnlockUI").WithNoArguments();

            CameraProcessor processor = new CameraProcessor(_camera, _cameraInfo);

            try
            {
                //processor.MakeAShoot(parameters, imageHandler);
                Assert.Fail();
            }
            catch (Exception anException)
            {
                Assert.AreEqual(exception, anException);
            }

            _mockery.VerifyAllExpectationsHaveBeenMet();
        }
Exemple #2
0
 public void TakeAPicture(ICameraInfo cameraInfo, IShootParameters shootingParameters, IImageHandler imageHandler)
 {
     _dispatcher.BeginInvoke((Action)(() =>
     {
         GetCameraProcessor(cameraInfo).TakeAPicture(shootingParameters, imageHandler);
     }));
 }
Exemple #3
0
        public void SetUp()
        {
            _mockery = new Mockery();

            _cameraProcessor = (ICameraProcessor)_mockery.NewMock(typeof(ICameraProcessor));

            _parameters   = (IShootParameters)_mockery.NewMock(typeof(IShootParameters));
            _imageHandler = (IImageHandler)_mockery.NewMock(typeof(IImageHandler));
            _cameraPool   = (ICameraPool)_mockery.NewMock(typeof(ICameraPool));
        }
        public IShootParameters[] CreateExposalBracketing(int aStep, int aCount, IShootParameters anInitialParameters)
        {
            EnumValueCollection exposals = Exposal.GetListFrom(_camera);

            IShootParameters[] result = new IShootParameters[aCount];

            for (int i = 0; i < aCount; ++i)
            {
                result[i]         = anInitialParameters.Copy();
                result[i].Exposal = (Exposal)exposals.GetWithRelatedIndex(result[i].Exposal, (aStep * i) - ((aCount - 1) * aStep) / 2);
            }

            return(result);
        }
        public IShootParameters[] CreateApertureBracketing(IShootParameters anInitialiParameters, Aperture[] anApertures)
        {
            IShootParameters[]  result    = new IShootParameters[anApertures.Length];
            EnumValueCollection exposals  = Exposal.GetListFrom(_camera);
            EnumValueCollection apertures = Aperture.GetListFrom(_camera);

            for (int i = 0; i < result.Length; ++i)
            {
                ShootParameters newParameter = anInitialiParameters.Copy();
                newParameter.Aperture = anApertures[i];
                newParameter.Exposal  = (Exposal)exposals.GetWithRelatedIndex(newParameter.Exposal, apertures.GetIndexDifferenceBeetween(anInitialiParameters.Aperture, anApertures[i]));
                result[i]             = newParameter;
            }

            return(result);
        }
        public void MakeAShootTest()
        {
            IImageHandler    imageHandler = (IImageHandler)_mockery.NewMock(typeof(IImageHandler));
            IShootParameters parameters   = (IShootParameters)_mockery.NewMock(typeof(IShootParameters));

            Expect.Once.On(_camera).Method("LockUI").WithNoArguments();
            Expect.Once.On(parameters).Method("ApplyTo").With(_camera);
            Expect.Once.On(_camera).Method("Shoot").WithNoArguments().Will(Return.Value(_imageFile));
            Expect.Once.On(imageHandler).Method("Handle").With(_imageFile);
            Expect.Once.On(_camera).Method("UnlockUI").WithNoArguments();

            CameraProcessor processor = new CameraProcessor(_camera, _cameraInfo);

            //processor.MakeAShoot(parameters, imageHandler);

            _mockery.VerifyAllExpectationsHaveBeenMet();
        }
 private Source.Image NewImageFrom(IShootParameters aParameters)
 {
     return(new Source.Image(CameraInfo, aParameters, this));
 }
 public void TakeAPicture(IShootParameters aShootParameters, IImageHandler imageHandler)
 {
     aShootParameters.ApplyTo(_camera);
     _camera.Shoot(imageHandler);
 }
Exemple #9
0
 public Image(ICameraInfo aCameraInfo, IShootParameters aParameters, IImageHandler aHandler)
 {
     _cameraInfo = aCameraInfo;
     _parameters = aParameters;
     _handler    = aHandler;
 }
 private Image NewImageFrom(IShootParameters aParameters)
 {
     return(new Image(CameraInfo, aParameters, NewSaveImageHandler()));
 }