コード例 #1
0
        public void UpdateDevContent_ShouldReturnTrue(int originalID, bool shouldUpdate)
        {
            DevContent newContent = new DevContent("Richard Torres", 1, false);

            bool updateResult = _repo.UpdateDevContent(originalID, newContent);

            Assert.AreEqual(shouldUpdate, updateResult);
        }
コード例 #2
0
        //Update Dev
        private void UpdateDev()
        {
            SeeAllDev();

            Console.WriteLine("\nEnter ID number of Developer you would like to update:");
            string value  = Console.ReadLine();
            int    oldDev = Convert.ToInt32(value);

            DevContent newDev = new DevContent();

            Console.WriteLine("What is the First and Last name of the developer:");
            newDev.FullName = Console.ReadLine();

            Console.WriteLine("What is the developers Identification Number:");
            string identAsInt = Console.ReadLine();

            newDev.IdentificationNumber = int.Parse(identAsInt);

            Console.WriteLine("Does this developer have Pluralsight access: (yes/no)");
            string yesNo = Console.ReadLine().Trim().ToLower();

            if (yesNo == "yes")
            {
                newDev.AccessPlural = true;
            }
            else if (yesNo == "no")
            {
                newDev.AccessPlural = false;
            }
            else
            {
                Console.WriteLine("Incorrect value entered, Pluralsight defaulted to NO. If this is incorrect then please update developer data.");
                newDev.AccessPlural = false;
            }

            bool wasUpdated = _contentRepo.UpdateDevContent(oldDev, newDev);

            if (wasUpdated)
            {
                Console.WriteLine("Developer successfuly updated.");
            }
            else
            {
                Console.WriteLine("Error... Could not update Developer.");
            }
        }