public void ShouldFindStraightLine() { var surface = SurfaceFactory.CreateSurface(10, 10); var ida = new Ida(surface); Path path = ida.FindPath(new Point(5, 5), new Point(7, 7)); Assert.AreEqual(3, path.Count); }
public void ShouldAvoidPixel() { var surface = SurfaceFactory.CreateSurface(10, 10); var ida = new Ida(surface); surface.SetPixel(5, 5, Color.Black); Path path = ida.FindPath(new Point(3, 3), new Point(7, 7)); Assert.AreEqual(8, path.Count); }
public void ShouldGoAroundWithoutTwisting() { var surface = SurfaceFactory.CreateSurface(400, 400); for (int y = 156; y <= 165; y++) surface.SetPixel(174, y, Color.Black); var ida = new Ida(surface); Path path = ida.FindPath(new Point(179, 161), new Point(169, 161)); Assert.AreEqual(15, path.Count); }
public void ShouldGoAround() { var surface = SurfaceFactory.CreateSurface(10, 10); surface.SetPixel(4, 4, Color.Black); surface.SetPixel(5, 4, Color.Black); surface.SetPixel(6, 4, Color.Black); var ida = new Ida(surface); Path path = ida.FindPath(new Point(5, 7), new Point(5, 2)); Assert.AreEqual(9, path.Count); }
public void Refresh() { conn.Open(); MySqlCommand cmd = new MySqlCommand("Select id, ime, prezime, email, telefon, adresa, extra from pacijenti", conn); adap = new MySqlDataAdapter(cmd); ds = new DataSet(); adap.Fill(ds, "LoadDataBindingPacijenti"); DataGridPacijent.DataContext = ds; Ida.Clear(); ime.Clear(); prezime.Clear(); email.Clear(); telefon.Clear(); adresa.Clear(); extra.Clear(); Search.Clear(); Save.Content = "Sačuvaj"; // Save iz buton sacuvaj Save.Background = Brushes.LightSkyBlue; conn.Close(); }
public void DataGridOnClick() { try { Ida.Clear(); // Try and Ida.Clear(); Stop null error object item = DataGridPacijent.SelectedItem; string ID = (DataGridPacijent.SelectedCells[0].Column.GetCellContent(item) as TextBlock).Text; string IME = (DataGridPacijent.SelectedCells[1].Column.GetCellContent(item) as TextBlock).Text; string PREZIME = (DataGridPacijent.SelectedCells[2].Column.GetCellContent(item) as TextBlock).Text; string EMAIL = (DataGridPacijent.SelectedCells[3].Column.GetCellContent(item) as TextBlock).Text; string TELEFON = (DataGridPacijent.SelectedCells[4].Column.GetCellContent(item) as TextBlock).Text; string ADRESA = (DataGridPacijent.SelectedCells[5].Column.GetCellContent(item) as TextBlock).Text; string EXTRA = (DataGridPacijent.SelectedCells[6].Column.GetCellContent(item) as TextBlock).Text; Ida.Text = ID; ime.Text = IME; prezime.Text = PREZIME; email.Text = EMAIL; adresa.Text = ADRESA; telefon.Text = TELEFON; extra.Text = EXTRA; } catch (Exception) { //code for any other type of exception } if (Ida.Text != "") { Save.Content = "Izmeni"; Save.Background = Brushes.LightCoral; } else { Save.Content = "Sačuvaj"; Save.Background = Brushes.LightSkyBlue; } }