public void DeleteAllBadgeAccess_ShouldReturnTrue() { var repo = new BadgesRepo(); var badge = new Badge(1, new List <string>()); repo.AddBadgeToCollection(badge); repo.AddBadgeAccess(1, "A1"); bool wasDeleted = repo.DeleteAllBadgeAccess(1); Assert.IsTrue(wasDeleted); }
/* * public void AddBadgeAccess() * { * Console.WriteLine($"Current door access: {String.Join(",", accessLog[userInput].Access)}"); * Console.Write("\n" + * "What door access would you like to add?: "); * // Setting all proper inputs to correct format * string addAccess = Console.ReadLine().ToUpper(); * if (possibleDoors.Contains(addAccess)) * { * if (accessLog[userInput].Access.Contains(addAccess)) * { * Console.WriteLine("\n" + * "Current badge has already been given access to chosen door. \n" + * "Press any key to continue..."); * Console.ReadKey(); * MainMenu(); * } * else * { * Console.Write($"\n" + * $"You want to add\n" + * $"\n" + * $"Door access: {addAccess} \n" + * $"To Badge ID: {accessLog[userInput].BadgeID}\n" + * $"\n" + * $"Correct (y/n)?: "); * string confirmUpdate = Console.ReadLine(); * if (confirmUpdate == "y" || confirmUpdate == "Y") * { * accessLog[userInput].Access.Add(addAccess); * Console.WriteLine("\n" + * "Door access added."); * } * else * { * Console.WriteLine("\n" + * "Update cancelled."); * } * } * } * else * { * Console.WriteLine("\n" + * "Assignment of unrecognized door, could not complete request.\n" + * "Press any key to continue..."); * Console.ReadKey(); * MainMenu(); * } * } */ public void DeleteAllBadgeAccessMenu() { Console.Clear(); Badge badge = new Badge(); Console.Write("Enter the Badge ID: "); string possibleID = Console.ReadLine(); if (Int32.TryParse(possibleID, out int userInput)) { badge.BadgeID = userInput; } else { Console.WriteLine("\n" + "Invalid Badge ID, please try again.\n" + "Press any key to continue..."); Console.ReadKey(); DeleteAllBadgeAccessMenu(); } if (accessLog.DoesListContainBadgeID(badge)) { Console.Clear(); Console.WriteLine($"Badge ID: {accessLog.DisplayBadgeID(userInput)}\n" + $"Door access: {accessLog.DisplayBadgeAccess(userInput)}"); Console.Write("\n" + "Delete all door access (y/n)?: "); string confirmDelete = Console.ReadLine(); if (confirmDelete == "y" || confirmDelete == "Y") { accessLog.DeleteAllBadgeAccess(userInput); Console.WriteLine("\n" + "All door access removed."); } else { Console.WriteLine("\n" + "Door access removal cancelled."); } Console.WriteLine("Press any key to continue..."); Console.ReadKey(); MainMenu(); } else { Console.WriteLine("\n" + "Selected Badge ID does not exist.\n" + "Press any key to continue..."); Console.ReadKey(); MainMenu(); } }