예제 #1
0
        public void CreateBadge_ShouldGetNotNull()
        {
            Arrange();
            Badge testBadge = _repo.GetBadgeByIDNumber(46783);

            Assert.IsNotNull(testBadge);
        }
예제 #2
0
        public void UpdateABadge()
        {
            Console.Clear();
            Console.WriteLine("What is the Badge ID of the badge you would like to change:");
            int   id    = int.Parse(Console.ReadLine());
            Badge badge = BadgesRepo.GetBadgeByIDNumber(id);

            if (badge != null)
            {
                Console.WriteLine($"{badge.BadgeID} has access to doors{badge.DoorNames}\n" +
                                  $"What would you like to do:\n" +
                                  $"1.Remove a door from this badge\n" +
                                  $"2.Add a door to this badge\n" +
                                  $"3.Go to the main menu");
                int updateInput = int.Parse(Console.ReadLine());
                if (updateInput == 1)
                {
                    Console.WriteLine("Which door would you like to remove:");
                    string removeInput = Console.ReadLine().ToLower();
                    bool   removed     = BadgesRepo.RemoveDoorFromBadge(id, removeInput);
                    if (removed == true)
                    {
                        Console.Clear();
                        Console.WriteLine($"The door was removed from the badge\n" +
                                          $"{badge.BadgeID} now has access to doors{badge.DoorNames}\n" +
                                          $"Hit enter to return to the main menu");
                        Console.ReadKey();
                        Menu();
                    }
                    else
                    {
                        Console.Clear();
                        Console.WriteLine("The program was unable to remove the requested door\n" +
                                          "Hit enter to return to the main menu");
                        Console.ReadKey();
                        Menu();
                    }
                }
                else if (updateInput == 2)
                {
                    Console.WriteLine("Please input the name of the door you would like to add to this badge:");
                    bool added = BadgesRepo.UpdateADoor(id, Console.ReadLine().ToUpper());
                    if (added == true)
                    {
                        Console.Clear();
                        Console.WriteLine($"The door was added to the badge\n" +
                                          $"{badge.BadgeID} now has access to doors{badge.DoorNames}\n" +
                                          $"Hit enter to return to the main menu");
                        Console.ReadKey();
                        Menu();
                    }
                    else
                    {
                        Console.Clear();
                        Console.WriteLine("The program was unable to add the requested door\n" +
                                          "Hit enter to return to the main menu");
                        Console.ReadKey();
                        Menu();
                    }
                }
                else
                {
                    Console.Clear();
                    Console.WriteLine("Returning you to the main menu, please hit enter.");
                    Console.ReadKey();
                    Menu();
                }
            }
        }