public void AddToDictionary_ShouldGetNotNull() { // Arrange--> Setting up the playing field Badge badge = new Badge(); badge.BadgeID = 12345; BadgeRepostiory repository = new BadgeRepostiory(); // Act--> Get/run the code we want to test repository.AddBadgeToDictionary(_badge); KeyValuePair <int, List <string> > badgeKey = repository.GetBadgeByBadgeID(12345); // Assert--> Use the assert class to verify the expected outcome Assert.IsNotNull(badgeKey.Key); Assert.IsNotNull(badgeKey.Value); }
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); } }