Example #1
0
        // Add a badge
        private void AddNewBadge()
        {
            Console.Clear();
            Badges newBadge = new Badges();

            // Badge ID
            Console.WriteLine("Enter new badge ID:");
            string badgeIDAsString = Console.ReadLine();

            newBadge.BadgeID = int.Parse(badgeIDAsString);

            // Add door name from list
            Console.WriteLine("Add a door to new badge");
            newBadge.ListOfDoorNames.Add(Console.ReadLine());

            // Add another door name from list
            Console.WriteLine("Add another door to new badge (y/n)");
            string addAnotherDoor = Console.ReadLine().ToLower();

            while (addAnotherDoor != "n")
            {
                // Add door name from list
                Console.WriteLine("Add a door to new badge");
                newBadge.ListOfDoorNames.Add(Console.ReadLine());
                Console.WriteLine("Add another door to new badge (y/n)");
                addAnotherDoor = Console.ReadLine().ToLower();
            }

            _badgesRepo.AddBadgeToDictionary(newBadge.BadgeID, newBadge.ListOfDoorNames);

            // Return user to main menu
            Console.Clear();
            Menu();
        }
Example #2
0
        private void AddBadge()
        {
            Console.Clear();
            Badges newBadge = new Badges();

            Console.WriteLine("ADD A BADGE \n" +
                              "\n");
            Console.WriteLine("What is the number on the badge:");
            newBadge.BadgeID = int.Parse(Console.ReadLine());

            bool hasFilledRooms = false;

            while (hasFilledRooms == false)
            {
                hasFilledRooms = Setup(newBadge, hasFilledRooms);
            }
            bool isSuccessful = _badgesRepo.AddBadgeToDictionary(newBadge);

            if (isSuccessful)
            {
                Console.WriteLine("Looks like you're all done." +
                                  "\n" +
                                  "Press any key to return to the Main Menu.");
                Console.ReadKey();
            }
            else
            {
                Console.WriteLine("Press any key to return to the Main Menu.");
                Console.ReadKey();
            }
        }
Example #3
0
 public void Arrange()
 {
     _repo        = new BadgesRepo();
     _newBadgeOne = new Badges(322, new List <string> {
         "A3", "B2", "N8"
     });
     _newBadgeTwo = new Badges(12, new List <string> {
         "A4", "A3", "B1"
     });
     _repo.AddBadgeToDictionary(_newBadgeOne);
     _repo.AddBadgeToDictionary(_newBadgeTwo);
 }
Example #4
0
        public void GetAllBadges_ShouldReturnAll()
        {
            Badges     allBadges     = new Badges();
            BadgesRepo allBadgesRepo = new BadgesRepo();

            allBadgesRepo.AddBadgeToDictionary(allBadges);
        }
 public void Arrange()
 {
     _repo  = new BadgesRepo();
     _badge = new Badges(3345, new List <string> {
         "C3", "B7", "D1"
     });
     _repo.AddBadgeToDictionary(_badge);
 }
Example #6
0
        public void AddBadgeToDirectory_ShouldAddBadge()
        {
            Badges     addBadge  = new Badges();
            BadgesRepo _addBadge = new BadgesRepo();
            bool       addResult = _addBadge.AddBadgeToDictionary(addBadge);

            Assert.IsTrue(addResult);
        }
        public void AddToDictionary_ShouldReturnTrue()
        {
            Badges     badge = new Badges();
            BadgesRepo repo  = new BadgesRepo();

            bool wasAdded = repo.AddBadgeToDictionary(badge);

            Assert.IsTrue(wasAdded);
        }
Example #8
0
        public void Arrange()
        {
            List <string> listOfDoors = new List <string>();

            _repo   = new BadgesRepo();
            _badges = new Badges(1, listOfDoors);

            _repo.AddBadgeToDictionary(_badges);
        }
Example #9
0
        public void AddToDictionary()
        {
            // Arrange
            Badges badge = new Badges();

            // Act
            _repo.AddBadgeToDictionary(5678, new List <string> {
                "A5"
            });

            // Assert
            Assert.IsNotNull(badge.BadgeID);
        }
Example #10
0
        private void AddABadge()
        {
            Console.Clear();
            Badges newBadge = new Badges();

            Console.Write("What is the number on the badge: ");
            newBadge.BadgeID = Convert.ToInt32(Console.ReadLine());

            newBadge.DoorNames = new List <string>();

            bool miniLoop = true;

            while (miniLoop)
            {
                Console.Write("List a door that it needs access to: ");
                string input = Console.ReadLine();
                newBadge.DoorNames.Add(input);

                Console.Write("Any other doors(y/n)?");
                string userInput = Console.ReadLine();

                switch (userInput)
                {
                case "y":
                    break;

                case "n":
                    _repo.AddBadgeToDictionary(newBadge);
                    miniLoop = false;
                    break;

                default:
                    Console.WriteLine("Please input a valid option");
                    Console.ReadKey();
                    break;
                }
            }
        }
Example #11
0
        public void CreateNewBadge()
        {
            Console.Clear();
            Badges newBadge = new Badges();

            Console.WriteLine("Enter the badge's ID number");
            string idNumberString = Console.ReadLine();

            newBadge.BadgeID = int.Parse(idNumberString);

            Console.WriteLine("What doors does this badge have access to...");
            bool addingDoors = true;

            Console.WriteLine("Please enter the doors one at a time...");
            listOfDoors.Add(Console.ReadLine());

            while (addingDoors)
            {
                Console.WriteLine("Press 1 to add another door, Press 2 to finish");

                var userInput = Console.ReadLine();
                switch (userInput)
                {
                case "1":
                    Console.WriteLine("Please enter another door...");
                    listOfDoors.Add(Console.ReadLine());
                    break;

                case "2":
                    newBadge.ListOfDoors = listOfDoors;
                    _badgesRepo.AddBadgeToDictionary(newBadge);
                    _dictionary.Add(newBadge.BadgeID, listOfDoors);
                    addingDoors = false;
                    break;

                default:
                    Console.WriteLine("Press 1 or 2");
                    Console.ReadKey();
                    break;
                }
            }
        }