private void AddDoor() { Console.Clear(); Console.WriteLine("ADD DOOR ACCESS \n" + "\n" + "Please type the badge ID# that you would like to update. \n"); int userInput = int.Parse(Console.ReadLine()); Console.Clear(); Badges badge = _badgesRepo.GetBadgeByID(userInput); ShowBadge(badge); Console.WriteLine("What door would you like to add?"); string doorToAdd = Console.ReadLine(); if (!badge.DoorNames.Contains(doorToAdd)) { _badgesRepo.AddNewRoom(userInput, doorToAdd); Console.WriteLine("Door added."); } else { Console.WriteLine("You entered an invalid response. No change was recorded for this badge."); } Console.WriteLine("Press any key to return to the main menu."); Console.ReadKey(); }
public void AddToAccessList_SholdGetNull() { //Arrange Badges badge = new Badges(); badge.BadgeID = 2; badge.DoorAccess.Add("Room 9"); // Act BadgesRepo repo = new BadgesRepo(); repo.AddToAccessList(badge); bool updateResult = repo.GetBadgeByID(1); // Assert Assert.IsTrue(updateResult); }
public void AddRoomToBadge_ShouldGetTrue() { // Arrange Badges badge = new Badges(); badge.BadgeID = 1; badge.DoorAccess.Add("Room 9"); // Act BadgesRepo repo = new BadgesRepo(); repo.AddRoomToBadge(badge); bool badgeFromList = repo.GetBadgeByID(1); // Assert Assert.AreEqual(badge.DoorAccess, badgeFromList); }
public void GetBadgeByID_ShouldReturnCorrectBadge() { Badges badgeID = _repo.GetBadgeByID(322); Assert.AreEqual(_newBadgeOne, badgeID); }