public void TestAddContentManually() { bool wasAdded = _badgeTests.AddBadgeToList(7777, new List <string>() { "A1" }); Assert.IsTrue(wasAdded); }
public void Arrange() { List <string> list1 = new List <string>(); list1.Add("A10"); list1.Add("B2"); list1.Add("C17"); _badgeRepo = new BadgeRepo(); _badge = new Badge(8675, list1); _badgeRepo.AddBadgeToList(_badge); }
public void AddToMenuTest_ShouldBeNotNull() { BadgeContent content = new BadgeContent(); content.BadgeID = 1102; BadgeRepo repo = new BadgeRepo(); repo.AddBadgeToList(content); BadgeContent directory = repo.GetBadgeById(1101); Assert.IsNotNull(directory); }
private void CreateANewBadge() { BadgeContent newBadge = new BadgeContent(); List <string> listOfDoors = new List <string>(); Console.Clear(); Console.WriteLine("Please enter the ID numbers on the badge."); string idAsString = Console.ReadLine(); int badgeId = int.Parse(idAsString); newBadge.BadgeID = badgeId; AnotherDoor: Console.WriteLine("Please enter the door access number."); string doorNum = Console.ReadLine(); listOfDoors.Add(doorNum); Console.WriteLine("Would you like to enter another door: yes/no "); string doorAnswer = Console.ReadLine(); switch (doorAnswer) { case "yes": goto AnotherDoor; case "no": newBadge.ListOfDoors.AddRange(listOfDoors); _badgeRepo.AddBadgeToList(newBadge); break; default: Console.WriteLine("The answer {0} was invalid", doorAnswer); break; } }
//Case 1: add a badge private void AddNewBadge() { Badge newBadge = new Badge(); Dictionary <int, List <string> > badgeDictionary = _badgeRepo.GetBadgeDictionary(); Console.Clear(); int newBadgeNum = 0; bool validBadgeNum = false; Console.WriteLine("What is the number on the new badge?"); newBadgeNum = int.Parse(Console.ReadLine()); while (!validBadgeNum) { bool currentNum = badgeDictionary.ContainsKey(newBadgeNum); if (currentNum) { Console.WriteLine("That badge is already in use. Please verify badge number of the new card."); Console.WriteLine("What is the number on the new badge?"); newBadgeNum = int.Parse(Console.ReadLine()); validBadgeNum = false; } else { validBadgeNum = true; } } List <string> newRoomList = new List <string>(); bool addDoor = true; while (addDoor) { Console.WriteLine($"List a door needing access with badge number {newBadgeNum}:"); string door = Console.ReadLine(); newRoomList.Add(door); Console.WriteLine("Would you like to add another door (y/n)"); string doorOption = Console.ReadLine().ToLower(); if (doorOption != "y") { if (doorOption == "n") { addDoor = false; } else { Console.WriteLine("Please enter y or n."); doorOption = Console.ReadLine().ToLower(); } } } newBadge.BadgeID = newBadgeNum; newRoomList.Sort(); newBadge.DoorNames = newRoomList; _badgeRepo.AddBadgeToList(newBadge); Console.WriteLine($"Badge number {newBadge.BadgeID} has been added."); }
public void AddBadge_ShouldGetNotNull() { List <string> list2 = new List <string>(); list2.Add("A12"); list2.Add("B1"); list2.Add("C30"); Badge newBadge = new Badge(4567, list2); _badgeRepo.AddBadgeToList(newBadge); Badge content = _badgeRepo.GetBadgeByID(4567); List <string> contentList = new List <string>(); Assert.IsNotNull(contentList); }