public void UpdateExistingBadge_ShouldReturnTrue()
        {
            // Arrange
            // TestInitialize
            Badge newBadge = new Badge(12345, new List <string>()
            {
                "A5", "A7"
            });

            //Act--> Get/run the code we want to test
            _repo.UpdateDoorToBadge(newBadge.BadgeID, "A1");

            // Assert
            Assert.IsTrue(newBadge.Doors.Count == 3);
        }
예제 #2
0
        private void UpdateABadge()
        {
            Badge newBadge = new Badge();

            Console.Clear();
            // Ask for the Badge ID of the badge we want to update
            Console.WriteLine("What is the badge number to update?");

            // Get that badge
            string oldBadge = Console.ReadLine();

            newBadge.BadgeID = int.Parse(oldBadge);

            KeyValuePair <int, List <string> > dictionaryBadge = _badgeRepo.GetBadgeByBadgeID(newBadge.BadgeID);

            string badgeKeyValuePair = string.Join(", ", dictionaryBadge.Value);

            Console.WriteLine(dictionaryBadge.Key + " has access to  " + badgeKeyValuePair)
            ;
            Console.WriteLine("What would you like to do?\n\n" +
                              "1. Remove a door.\n" +
                              "2. Add a door.");

            string input = Console.ReadLine();

            if (input == "1")
            {
                Console.WriteLine("Which door would you like to remove?");
                string door = Console.ReadLine();
                _badgeRepo.RemoveDoorFromBadge(newBadge.BadgeID, door);
            }
            else
            {
                Console.WriteLine("Which door would you like to add?");
                string door = Console.ReadLine();

                // Verify the update worked
                _badgeRepo.UpdateDoorToBadge(newBadge.BadgeID, door);
            }
        }