Пример #1
0
        private void AddABadge()
        {
            Console.WriteLine();
            Dictionary <int, Badges> listOfBadges = _badgeRepo.GetDictionaryAllBadges();
            Badges newBadge       = new Badges();
            bool   hasFilledRooms = false;

            while (hasFilledRooms == false)
            {
                Console.WriteLine($"Badge ID: {listOfBadges.Count + 1}");
                Console.WriteLine();
                Console.WriteLine("Do you want to add door access to this badge? Enter: (Y/N) ");
                string userInputHasFilledRooms = Console.ReadLine().ToLower();
                if (userInputHasFilledRooms == "y")
                {
                    Console.WriteLine("List the door this badge needs access to:");
                    string accessToDoors = Console.ReadLine();
                    newBadge.DoorNames.Add(accessToDoors);
                }
                else if (userInputHasFilledRooms == "n")
                {
                    hasFilledRooms = true;
                    _badgeRepo.AddABadge(newBadge);
                }
                else
                {
                    hasFilledRooms = true;
                    Console.WriteLine("Press any key to return to main menu");
                    Console.ReadKey();
                    ProgramMenu();
                }
            }
        }
 public void AddABadge_ShouldNotGetNull()
 {
     //Act
     _repo.AddABadge(_badges);
     //Assert
     Assert.IsNotNull(_badges);
 }
 public void Arrange()
 {
     _repo   = new BadgesRepository();
     _badges = new Badges(new List <string> {
         "A1", "A3", "A6"
     });
     _repo.AddABadge(_badges);
 }