Exemplo n.º 1
0
        public void GetGardenPlant()
        {
            Database     db = new Database();
            PlantsLookup b  = new PlantsLookup();

            b = db.GetPlantById(2);
            Assert.AreNotEqual(b, null);
        }
Exemplo n.º 2
0
        public void GettLinkToImage()
        {
            int          plantId  = 2;
            string       expected = "pack://application:,,,/Pictures/Plants/Artichoke.png";
            Database     db       = new Database();
            PlantsLookup p        = new PlantsLookup();

            p = db.GetPlantById(plantId);
            string actual = p.PictureSource;

            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 3
0
        private void RibbonButton_Plants(object sender, RoutedEventArgs e)
        {
            Button someButton = sender as Button;

            if (someButton != null)
            {
                isDrawingBeds = false;

                int  tag;
                bool res = int.TryParse((string)someButton.Tag, out tag);
                if (res == false)
                {
                    MessageBox.Show("Unable to fetch the plant from database", "Database error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    return;
                }

                pLookup = db.GetPlantById(tag);
            }
        }