Esempio n. 1
0
        public void MockClicloCajero()
        {
            while (this.estado != EEstado.Atendido)
            {
                switch (this.estado)
                {
                case EEstado.Ingresado:
                    Thread.Sleep(2000);
                    this.estado = EEstado.Cobrado;
                    this.InformaEstado.Invoke(this, EventArgs.Empty);
                    break;

                case EEstado.Cobrado:
                    Thread.Sleep(2000);
                    this.estado = EEstado.Atendido;
                    this.InformaEstado.Invoke(this, EventArgs.Empty);
                    break;

                default:
                    break;
                }
            }
            try
            {
                InformaCajero.Invoke(this);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Esempio n. 2
0
        public void MockCicloCajero()
        {
            while (this.estado != EEstado.Atendido)
            {
                switch (this.estado)
                {
                case EEstado.Ingresado:
                    Thread.Sleep(2000);
                    this.estado = EEstado.Cobrado;
                    this.InformaEstado.Invoke(this, EventArgs.Empty);
                    break;

                case EEstado.Cobrado:
                    Thread.Sleep(2000);
                    this.estado = EEstado.Atendido;
                    this.InformaEstado.Invoke(this, EventArgs.Empty);
                    break;

                default:
                    break;
                }
            }
            try
            {
                // this, referencia a la instancia.
                InformaCajero.Invoke(this);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
        }