public void EnumFieldsTest() { IsoSpeedEnum iso = IsoSpeedEnum.iso640; ApertureEnum aperture = ApertureEnum.f72; ExposalEnum exposal = ExposalEnum.t6; ImageQualityEnum imageQuality = ImageQualityEnum.PPT_sRAW1; ConfigureMockCamera(null, null, null, new IsoSpeedEnum[] { }, new ApertureEnum[] { }, new ExposalEnum[] { }, new ImageQualityEnum[] { }, iso, aperture, exposal, imageQuality); CameraInfo cameraInfo = new CameraInfo(_camera); Assert.AreEqual(IsoSpeed.With(iso), cameraInfo.CurrentIsoSpeed); Assert.AreEqual(Aperture.With(aperture), cameraInfo.CurrentAperture); Assert.AreEqual(Exposal.With(exposal), cameraInfo.CurrentExposal); Assert.AreEqual(ImageQuality.With(imageQuality), cameraInfo.CurrentImageQuality); _mockery.VerifyAllExpectationsHaveBeenMet(); }
public void ApplyToTest() { Mockery mockery = new Mockery(); ICamera camera = (ICamera)mockery.NewMock(typeof(ICamera)); IsoSpeedEnum iso = IsoSpeedEnum.iso50; ApertureEnum aperture = ApertureEnum.f10; ExposalEnum exposal = ExposalEnum.t1_100; Expect.Once.On(camera).Method("SetProperty").With(EDSDK.PropID_ISOSpeed, (int)iso); Expect.Once.On(camera).Method("SetProperty").With(EDSDK.PropID_Av, (int)aperture); Expect.Once.On(camera).Method("SetProperty").With(EDSDK.PropID_Tv, (int)exposal); ShootParameters parameters = new ShootParameters(iso, aperture, exposal); parameters.ApplyTo(camera); mockery.VerifyAllExpectationsHaveBeenMet(); }
private void ConfigureMockCamera(string aCameraId, string aProductName, string anOwnerName, IsoSpeedEnum[] anIsoSpeeds, ApertureEnum[] anApertures, ExposalEnum[] anExposals, ImageQualityEnum[] anImageQualities, IsoSpeedEnum anIsoSpeed, ApertureEnum anAperture, ExposalEnum anExposal, ImageQualityEnum anImageQuality) { Expect.Once.On(_camera).GetProperty("Id").Will(Return.Value(aCameraId)); Expect.Once.On(_camera).GetProperty("ProductName").Will(Return.Value(aProductName)); Expect.Once.On(_camera).GetProperty("OwnerName").Will(Return.Value(anOwnerName)); Expect.Once.On(_camera).Method("GetAvailableValues").With(EDSDKLib.EDSDK.PropID_ISOSpeed).Will(Return.Value(anIsoSpeeds)); Expect.Once.On(_camera).Method("GetAvailableValues").With(EDSDKLib.EDSDK.PropID_Av).Will(Return.Value(anApertures)); Expect.Once.On(_camera).Method("GetAvailableValues").With(EDSDKLib.EDSDK.PropID_Tv).Will(Return.Value(anExposals)); Expect.Once.On(_camera).Method("GetAvailableValues").With(EDSDKLib.EDSDK.PropID_ImageQuality).Will(Return.Value(anImageQualities)); Expect.Once.On(_camera).GetProperty("IsoSpeed").Will(Return.Value((int)anIsoSpeed)); Expect.Once.On(_camera).GetProperty("ApertureValue").Will(Return.Value((int)anAperture)); Expect.Once.On(_camera).GetProperty("ExposalValue").Will(Return.Value((int)anExposal)); Expect.Once.On(_camera).GetProperty("ImageQualityValue").Will(Return.Value((int)anImageQuality)); }
public IsoSpeed(IsoSpeedEnum anIsoSpeedEnum, string aDisplayString) : base((uint)anIsoSpeedEnum, aDisplayString, EDSDK.PropID_ISOSpeed) { }
public static IsoSpeed With(IsoSpeedEnum anIsoSpeedEnum) { return(new IsoSpeed(anIsoSpeedEnum, string.Format("#{0}", anIsoSpeedEnum))); }
public ShootParameters(IsoSpeedEnum aIsoSpeedEnum, ApertureEnum aApertureEnum, ExposalEnum aExposalEnum) : this(IsoSpeed.With(aIsoSpeedEnum), Source.Aperture.With(aApertureEnum), Source.Exposal.With(aExposalEnum)) { }