예제 #1
0
        // Constructor for subclasses of this class
        public AddEvent(Window parent, ListStore eventsModel)
        {
            Glade.XML gxml = new Glade.XML("add_event.glade", "dlgAddEvent", null);
            gxml.Autoconnect(this);

            this.dlgAddEvent.TransientFor = parent;

            // Set actual day and month
            this.spbtnDay.Value  = DateTime.Now.Day;
            this.cmbMonth.Active = DateTime.Now.Month - 1;

            this.spbtnYear.Adjustment.Lower = DateTime.Now.Year;
            this.spbtnYear.Adjustment.Upper = 9999;
            this.spbtnYear.Value            = DateTime.Now.Year;

            // Load event types
            EventTypesManager etm = EventTypesManager.Instance;

            this.cmbEventTypes.RemoveText(0);

            foreach (EventType anEventType in etm.RetrieveAll())
            {
                this.cmbEventTypes.AppendText(anEventType.Name);
            }

            this.eventsModel = eventsModel;
        }
        public void RecuperarTodosLosEventos()
        {
            // Limpiamos el caché
            controladorTiposEvento.CleanCache();

            EventType[] todosLosTiposEvento = controladorTiposEvento.RetrieveAll();

            // Verificamos que sean tres (milton, gisela y daiana)
            Assert.AreEqual(3, todosLosTiposEvento.Length);

            EventType mEnsayo = null;
            EventType mMisa   = null;
            EventType mOtro   = null;

            foreach (EventType unTipoEvento in todosLosTiposEvento)
            {
                if (unTipoEvento.Name == "Ensayo")
                {
                    mEnsayo = unTipoEvento;
                }
                else if (unTipoEvento.Name == "Misa")
                {
                    mMisa = unTipoEvento;
                }
                else if (unTipoEvento.Name == "Otro")
                {
                    mOtro = unTipoEvento;
                }
            }

            Assert.AreEqual(ensayo.Id, mEnsayo.Id);
            Assert.AreEqual(ensayo.Name, mEnsayo.Name);

            Assert.AreEqual(misa.Id, mMisa.Id);
            Assert.AreEqual(misa.Name, mMisa.Name);

            Assert.AreEqual(otro.Id, mOtro.Id);
            Assert.AreEqual(otro.Name, mOtro.Name);
        }