public void CreateCoffeeTest() { bool expected = true; CofeeBreak cof = new CofeeBreak() { Number = "201906300848", Creation = DateTime.Now, End = DateTime.Now, Client = "20295782K", Mode = TipoCoff.CB001, EvType = 10, Start = DateTime.Now, Finish = DateTime.Now, Assist = 10, Additional = 20, Realized = false, Total = 987654321, Observation = "Algo Esta mal con el constr", Veg = false }; bool result = cof.Create(); //Preguntamos si son iguales Assert.AreEqual(expected, result); }
private async void BtnAgregarContrato_Click(object sender, RoutedEventArgs e) { if (CliCheck()) { try { switch (cmbTipoEv.SelectedIndex) { case 0: CofeeBreak cb = new CofeeBreak(DateTime.Today, DateTime.Today.AddDays(2), txtRutCliente.Text, (DateTime)dpkStartDte.SelectedDate, (DateTime)dpkFTerm.SelectedDate, int.Parse(txtCAss.Text), int.Parse(txtPersonalAdicional.Text), txtObservacion.Text, (bool)cbkVeg.IsChecked, cmbCofMod.SelectedItem.ToString()); if (cb.Read()) { await this.ShowMessageAsync("Aviso", string.Format( "Contrato ya existe, no se puede agregar.")); } else { if (cb.Create()) { await this.ShowMessageAsync("Aviso", string.Format( "Contrato creado con éxito.")); } else { await this.ShowMessageAsync("Error", string.Format( "No se pudo agregar el contrato.")); } } break; case 1: Cocktail ck = new Cocktail(DateTime.Today, DateTime.Today.AddDays(2), txtRutCliente.Text, (DateTime)dpkStartDte.SelectedDate, (DateTime)dpkFTerm.SelectedDate, int.Parse(txtCAss.Text), int.Parse(txtPersonalAdicional.Text), txtObservacion.Text, (bool)cbkAmbCk.IsChecked, (bool)cbkAmbMusCk.IsChecked, (bool)cbkCliMusCk.IsChecked, cmbCockMod.SelectedItem.ToString(), (int)cmbAmbCk.SelectedItem); if (ck.Read()) { await this.ShowMessageAsync("Aviso", string.Format( "Contrato ya existe, no se puede agregar.")); } else { if (ck.Create()) { await this.ShowMessageAsync("Aviso", string.Format( "Contrato creado con éxito.")); } else { await this.ShowMessageAsync("Error", string.Format( "No se pudo agregar el contrato.")); } } break; case 2: Cena ce = new Cena(DateTime.Today, DateTime.Today.AddDays(2), txtRutCliente.Text, (DateTime)dpkStartDte.SelectedDate, (DateTime)dpkFTerm.SelectedDate, int.Parse(txtCAss.Text), int.Parse(txtPersonalAdicional.Text), txtObservacion.Text, (int)cmbAmbCe.SelectedItem, (bool)cbkAmbMusCe.IsChecked, (bool)rbtLocalOb.IsChecked, (bool)rbtLocalOt.IsChecked, int.Parse(txtUf.Text), cmbCenaMod.SelectedItem.ToString()); if (ce.Read()) { await this.ShowMessageAsync("Aviso", string.Format( "Contrato ya existe, no se puede agregar.")); } else { if (ce.Create()) { await this.ShowMessageAsync("Aviso", string.Format( "Contrato creado con éxito.")); } else { await this.ShowMessageAsync("Error", string.Format( "No se pudo agregar el contrato.")); } } break; } } catch (Exception zz) { MessageBox.Show(zz.Message, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error); } AllInit(); } else { await this.ShowMessageAsync("Error", string.Format( "El cliente no se encuentra registrado.")); } }