private void filtroPriorita_SelectedIndexChanged(object sender, EventArgs e) { switch (this.filtroPriorita.Text) { case "INFO": _filtroEventi["priorita"] = new FiltroPriorita(eventi.Priorita.Info); break; case "WARNING": _filtroEventi["priorita"] = new FiltroPriorita(eventi.Priorita.Warning); break; case "ALERT": _filtroEventi["priorita"] = new FiltroPriorita(eventi.Priorita.Alert); break; case "CRITICAL": _filtroEventi["priorita"] = new FiltroPriorita(eventi.Priorita.Critical); break; case "FATAL": _filtroEventi["priorita"] = new FiltroPriorita(eventi.Priorita.Fatal); break; default: _filtroEventi.Remove("priorita"); break; } seedListView(_filtroEventi.Values.ToList()); }
public void TestFiltroPriorita() { IFiltroEvento filter = new FiltroPriorita(Priorita.Info); IEventoSismico e = EventoSismicoTest.createMockEvent(); // Should be false Assert.IsFalse(filter.Filtra(e)); // Should be true IFiltroEvento filter2 = new FiltroPriorita(Priorita.Fatal); Assert.IsTrue(filter2.Filtra(e)); }