예제 #1
0
 /// <summary>
 /// Creates the object based on parameters.
 /// </summary>
 /// <param name="communication">Communidation interface of the Pinpad used</param>
 /// <param name="name">File Name</param>
 /// <param name="path">File Path</param>
 /// <param name="sucessfullyLoaded">Was the file successfully loaded?</param>
 /// <param name="totalLoaded">Amount of files loaded</param>
 /// <param name="totalToLoad">Amount of files to load</param>
 public PinpadFileLoadedEventArgs(PinpadCommunication communication, string name, string path, bool sucessfullyLoaded, int totalLoaded, int totalToLoad)
 {
     this.Communication     = communication;
     this.Name              = name;
     this.Path              = path;
     this.SucessfullyLoaded = sucessfullyLoaded;
     this.TotalLoaded       = totalLoaded;
     this.TotalToLoad       = totalToLoad;
 }
예제 #2
0
        //[Test]
        public void Pinpad_SetTimeoutWriteAndRead()
        {
            IPinpadConnection   conn = PinpadConnectionProvider.GetAt("COM4");
            PinpadCommunication comm = new PinpadCommunication(conn);

            comm.SetTimeout(5000, 5000);

            Assert.AreEqual(conn.ReadTimeout, 5000);
            Assert.AreEqual(conn.WriteTimeout, 5000);
        }
예제 #3
0
        public void Pinpad_GetValueInOptionsStringWithCircularBehavior_test()
        {
            IPinpadConnection conn = PinpadConnectionProvider.GetFirst();

            PinpadCommunication comm    = new PinpadCommunication(conn);
            PinpadInfos         infos   = new PinpadInfos(comm);
            IPinpadDisplay      display = new PinpadDisplay(comm);
            PinpadKeyboard      key     = new PinpadKeyboard(comm, infos, display);

            string result = key.DataPicker.GetValueInOptions("Carnaval", true, "Simpatiaequaseamor", "OrquestraVoadora", "SargentoPimenta", "Carmelitas");
        }
예제 #4
0
        public void Pinpad_GetValueInOptionsShortWithCircularBehavior_test()
        {
            IPinpadConnection conn = PinpadConnectionProvider.GetFirst();

            PinpadCommunication comm    = new PinpadCommunication(conn);
            PinpadInfos         infos   = new PinpadInfos(comm);
            IPinpadDisplay      display = new PinpadDisplay(comm);
            PinpadKeyboard      key     = new PinpadKeyboard(comm, infos, display);

            key.DataPicker.GetValueInOptions("Menu", true, 1, 2, 3);
        }
예제 #5
0
        public void PinpadDisplay_Construction_ShouldThrowException_IfPinpadCommunicationIsNull()
        {
            // Assert
            Assert.Throws <ArgumentNullException>(() =>
            {
                // Arrange
                PinpadCommunication nullPinpadConnection = null;

                // Act
                PinpadDisplay display = new PinpadDisplay(nullPinpadConnection);
            });
        }
예제 #6
0
        public void PinpadDisplay_Construction_ShouldNotReturnNull()
        {
            // Arrange
            IPinpadConnection   connectionStub = Mock.Of <IPinpadConnection>();
            PinpadCommunication comm           = new PinpadCommunication(connectionStub);

            // Act
            PinpadDisplay display = new PinpadDisplay(comm);

            // Assert
            Assert.IsNotNull(display);
        }
예제 #7
0
        public void OPN_test()
        {
            IPinpadConnection conn = PinpadConnectionProvider.GetFirst();

            PinpadCommunication comm = new PinpadCommunication(conn);

            OpnRequest  opn     = new OpnRequest();
            OpnResponse opnResp = comm.SendRequestAndReceiveResponse <OpnResponse>(opn);

            DspRequest dsp = new DspRequest();

            dsp.DSP_MSG.Value = new SimpleMessageProperty("ola");

            GenericResponse r = comm.SendRequestAndReceiveResponse <GenericResponse>(dsp);
        }
예제 #8
0
        public void Gertec_EX07_test()
        {
            // testes:
            //this.mockedPinpadConnection = new MockedPinpadConnection();

            // prod:
            IPinpadConnection conn = PinpadConnectionProvider.GetFirst();

            PinpadCommunication comm = new PinpadCommunication(conn);

            GciGertecRequest request = new GciGertecRequest();

            request.NumericInputType.Value       = KeyboardNumberFormat.Decimal;
            request.TextInputType.Value          = KeyboardTextFormat.None;
            request.LabelFirstLine.Value         = FirstLineLabelCode.TypeNumber;
            request.LabelSecondLine.Value        = SecondLineLabelCode.GasPump;
            request.MaximumCharacterLength.Value = 1;
            request.MinimumCharacterLength.Value = 10;
            request.TimeOut.Value  = 60;
            request.TimeIdle.Value = 0;

            Debug.WriteLine(request.CommandString);

            GertecEx07Response response = comm
                                          .SendRequestAndReceiveResponse <GertecEx07Response>(request);

            if (response != null)
            {
                Debug.WriteLine("Response status: " + response.RSP_STAT.Value);
                Debug.WriteLine("Value typed: " + response.RSP_RESULT.Value);
            }
            else
            {
                Debug.WriteLine("Resposta nula. Cancelamento ou timeout.");
            }
        }