Exemple #1
0
        private void AddNewBadge()
        {
            Console.Clear();
            SecurityID    newDude  = new SecurityID();
            List <string> newDoors = new List <string>();


            Console.Write("Please Enter New Badge ID: ");
            int badge = Convert.ToInt32(Console.ReadLine());

            newDude.BadgeID = badge;

            bool coolRunnings = true;

            while (coolRunnings)
            {
                Console.Write("List Door Access Needed: ");
                newDoors.Add(Console.ReadLine());
                newDude.Doors = newDoors;
                Console.Write("Add Another Doors? (y/n)");
                string moreDoors = Console.ReadLine().ToLower();

                if (moreDoors == "y")
                {
                    coolRunnings = true;
                }
                else
                {
                    coolRunnings = false;
                }
            }
            _repo.CreateNewBadge(newDude);
            bool wasAddedCorrectly = _repo.DoesKeyExist(newDude.BadgeID);

            if (wasAddedCorrectly)
            {
                Console.WriteLine("Badge Successfully Created");
                Console.Write("Press Any Key To Continue to Main Menu.");
                Console.ReadLine();
            }
            else
            {
                Console.WriteLine("Oops, Something Went Wrong. Try Again.");
            }
        }
        public void Arrange()
        {
            _repo         = new SecurityRepository();
            _dude         = new SecurityID();
            _dude.BadgeID = 69;
            _repo.AddDoorToExistingBadge(_dude);

            _repo.CreateNewBadge(_dude);
        }
        public void CreateNewBadgeID()
        {
            List <string> stuff = new List <string>();

            SecurityID dibz     = new SecurityID(1, stuff);
            bool       wasAdded = _repo.CreateNewBadge(dibz);

            Assert.IsTrue(wasAdded);
        }