public void DataPickerKeys_Construction_ShouldNotReturnNullAndReturnDefaultDataPickerKeys() { // Arrange DataPickerKeys keys = null; // Act keys = new DataPickerKeys(); // Assert Assert.IsNotNull(keys); Assert.AreEqual(PinpadKeyCode.Function3, keys.UpKey); Assert.AreEqual(PinpadKeyCode.Function4, keys.DownKey); }
public void DataPickerKeysFactory_GetUpAndDownKeys_ShouldReturnGertecKeys_WhenNullInfosArePassed() { // Arrange IPinpadInfos infos = new Mock <IPinpadInfos>().Object; // Act DataPickerKeys keys = infos.GetUpAndDownKeys(); // Assert Assert.IsNotNull(keys); Assert.AreEqual(PinpadKeyCode.Function3, keys.UpKey); Assert.AreEqual(PinpadKeyCode.Function4, keys.DownKey); }
public void DataPickerKeys_Construction_ShouldThrowException_IfUpKeyIsCancelKey() { // Assert Assert.Throws <ArgumentException>(() => { // Arrange DataPickerKeys keys = null; // Act keys = new DataPickerKeys { UpKey = PinpadKeyCode.Cancel }; }); }
public void DataPickerKeys_Construction_ShouldThrowException_IfDownKeyIsUndefined() { // Assert Assert.Throws <ArgumentException>(() => { // Arrange DataPickerKeys keys = null; // Act keys = new DataPickerKeys { DownKey = PinpadKeyCode.Undefined }; }); }
public void DataPickerKeys_Construction_ShouldThrowException_IfUpAndDownKeysAreTheSame() { // Assert Assert.Throws <ArgumentException>(() => { // Arrange DataPickerKeys keys = null; // Act keys = new DataPickerKeys { UpKey = PinpadKeyCode.Function1, DownKey = PinpadKeyCode.Function1 }; }); }
public void DataPickerKeys_Construction_ShouldNotReturnNullAndParametersShouldMatch() { // Arrange DataPickerKeys keys = null; // Act keys = new DataPickerKeys { UpKey = PinpadKeyCode.Function3, DownKey = PinpadKeyCode.Function2 }; // Assert Assert.IsNotNull(keys); Assert.AreEqual(PinpadKeyCode.Function3, keys.UpKey); Assert.AreEqual(PinpadKeyCode.Function2, keys.DownKey); }
public void DataPickerKeysFactory_GetUpAndDownKeys_ShouldReturnVerifoneKeys_WhenVerifoneInfosArePassed() { // Arrange var mock = new Mock <IPinpadInfos>(); mock.SetupGet(x => x.ManufacturerName).Returns("VERIFONE"); mock.SetupGet(x => x.Model).Returns("VX820"); IPinpadInfos infos = mock.Object; // Act DataPickerKeys keys = infos.GetUpAndDownKeys(); // Assert Assert.IsNotNull(keys); Assert.AreEqual(PinpadKeyCode.Function1, keys.UpKey); Assert.AreEqual(PinpadKeyCode.Function3, keys.DownKey); }
// Constructor /// <summary> /// Build a data picker with a reference to keyboard and display. /// </summary> /// <param name="keyboard"><seealso cref="IPinpadKeyboard"/> implementation.</param> /// <param name="infos"><seealso cref="IPinpadInfos"/> implementation.</param> /// <param name="display"><seealso cref="IPinpadDisplay"/> implementation.</param> public DataPicker(IPinpadKeyboard keyboard, IPinpadInfos infos, IPinpadDisplay display) { this._keyboard = keyboard; this._display = display; this.DataPickerKeys = infos.GetUpAndDownKeys(); }