public void CreateBadge() { Badge badge = new Badge(); badge.DoorNames = new List <string>(); Console.Clear(); Console.WriteLine("Enter a new badge number"); badge.BadgeID = int.Parse(Console.ReadLine()); Console.Clear(); Console.WriteLine($"Badge ID: {badge.BadgeID}\n"); Console.WriteLine($"Enter a door that #{badge.BadgeID} will need access to: "); badge.DoorNames.Add(Console.ReadLine()); Console.WriteLine($"Door was add successfully to {badge.BadgeID}"); bool addAnother = true; while (addAnother) { Console.WriteLine($"Would you like to add another door to Badge #{badge.BadgeID}? (y/n)"); string answer = Console.ReadLine(); switch (answer) { case "y": Console.WriteLine($"Enter a door that #{badge.BadgeID} will need access to: "); badge.DoorNames.Add(Console.ReadLine()); break; case "n": addAnother = false; break; } } _repository.AddBadgeToDirectory(badge); //Adding to repo Console.WriteLine($"Badge #{badge.BadgeID} has been successfully created!" + $"\n" + $"Press any key to continue..."); Console.ReadKey(); }
public void GetAllBadges_ShouldReturnCorrectDict() { List <string> doors = new List <string>() { "A1", "B12", "C4" }; Badge badge = new Badge(45, doors); badgeRepo repo = new badgeRepo(); repo.AddBadgeToDirectory(badge); Dictionary <int, List <string> > testDict = repo.GetAllBadges(); }
public void AddBadgeToDirectory_ShouldReturnTrue() { Badge badge = new Badge() { }; badgeRepo repo = new badgeRepo() { }; bool addResult = repo.AddBadgeToDirectory(badge); Assert.IsTrue(addResult); }