private void Update()
        {
            Console.WriteLine("Enter Name to update: ");
            string name   = Console.ReadLine();
            Cactus cactus = cactusBusiness.GetCactusByName(name);

            if (cactus != null)
            {
                Console.WriteLine("Enter name: ");
                cactus.Name = Console.ReadLine();
                Console.WriteLine("Enter height: ");
                cactus.Height = decimal.Parse(Console.ReadLine());
                Console.WriteLine("Enter thorns: ");
                cactus.Thorns = Console.ReadLine();
                Console.WriteLine("Enter seasons Id: ");
                Console.WriteLine("(1-spring, 2-summer, 3-autumn, 4-winter)");
                cactus.SeasonsId = int.Parse(Console.ReadLine());
                cactusBusiness.Update(cactus);
                Console.WriteLine("The cactus was updated successfully!");
            }
            else
            {
                Console.WriteLine("Cactus not found!");
            }
        }
Beispiel #2
0
        public void Update_Cactus()
        {
            var mockContext    = new Mock <GardenContext>();;
            var cactusBusiness = new CactusBusiness();
            var Cactus         = new Cactus()
            {
                Name = "Cactus1"
            };

            try { cactusBusiness.Update(Cactus); }
            catch { mockContext.Verify(m => m.Entry(It.IsAny <Cactus>()), Times.Once()); }
        }