public void Findによる検索_ヒットするデータが存在しない場合() { //setUp var sut = new RrDb(null, null, null, "example.com", true); sut.Add(new RrA("www1.example.com.", 100, new Ip("192.168.0.1"))); var expected = false; //exercise var actual = sut.Find("www.example.com.", DnsType.A); //verify Assert.That(actual, Is.EqualTo(expected)); }
private void button1_Click(object sender, EventArgs e) { if (textBoxLastName.Text.Length > 0 || textBoxFirstName.Text.Length > 0 || textBoxSecondName.Text.Length > 0) { dataGridView1.Rows.Clear(); try { RrDb db = new RrDb(); var finded = db.Find(textBoxLastName.Text, textBoxFirstName.Text, textBoxSecondName.Text); foreach (var historyRow in finded) { DataGridViewRow r = new DataGridViewRow(); r.CreateCells(dataGridView1, new Object[] { historyRow.date.ToShortDateString(), historyRow.card_number, historyRow.last_name, historyRow.first_name, historyRow.second_name, historyRow.birthday.Value.ToShortDateString(), historyRow.type == (Int64)rr_history.RowType.Diagnostics ? "Диагностика" : "Оценка", (historyRow.photo == null || historyRow.photo.Length == 0) ? "Добавить" : "Просмотр", "Удалить" }); r.Tag = historyRow; dataGridView1.Rows.Add(r); } } catch (Exception ex) { MessageBox.Show("Не удалось выполнить запрос к БД (" + ex.Message + ")", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Необходимо ввести фамилию, имя или отчество пациента", "Информация", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void button1_Click(object sender, EventArgs e) { if (textBoxLastName.Text.Length > 0 || textBoxFirstName.Text.Length > 0 || textBoxSecondName.Text.Length > 0) { dataGridView1.Rows.Clear(); try { RrDb db = new RrDb(); var finded = db.Find(textBoxLastName.Text, textBoxFirstName.Text, textBoxSecondName.Text, (int)rr_history.RowType.Diagnostics); foreach (var historyRow in finded) { JavaScriptSerializer serializer = new JavaScriptSerializer(); var estimation = serializer.Deserialize <DiagnosticCard>(historyRow.info); DataGridViewRow r = new DataGridViewRow(); r.CreateCells(dataGridView1, new Object[] { historyRow.last_name, historyRow.first_name, historyRow.second_name, historyRow.birthday.Value.ToShortDateString(), estimation.chooseMethod() }); r.Tag = historyRow; dataGridView1.Rows.Add(r); } } catch (Exception ex) { MessageBox.Show("Не удалось выполнить запрос к БД (" + ex.Message + ")", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Необходимо ввести фамилию, имя или отчество пациента", "Информация", MessageBoxButtons.OK, MessageBoxIcon.Information); } }