private void ListBoxCarro_DragDrop(object sender, DragEventArgs e) { try { var lbxOrigem = e.Data.GetData(typeof(ListBox)) as ListBox; var lbxDestino = sender as ListBox; if (lbxOrigem != null && lbxDestino != null && lbxOrigem != lbxDestino) { _cenario.EntrarNoCarro((Pessoa)lbxOrigem.SelectedItem); CarregarLocais(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void Entrar_pessoa_com_carro_lotado() { _cenario.Iniciar(); _cenario.EntrarNoCarro(_cenario.ObterPersonagensNoTerminal().First()); _cenario.EntrarNoCarro(_cenario.ObterPersonagensNoTerminal().First()); var ex = Assert.Throws <Exception>(() => _cenario.EntrarNoCarro(_cenario.ObterPersonagensNoTerminal().First())); Assert.AreEqual("Carro está lotado.", ex.Message); }