public void Seed() { _badgeRepo.AddBadge(12345, new List <string> { "A7" }); _badgeRepo.AddBadge(22345, new List <string> { "A1", "A4", "B1", "B2" }); _badgeRepo.AddBadge(32345, new List <string> { "A4", "A5" }); }
public void Arrange() { Badge badge = new Badge(4, new List <string>() { "A2", "A7" }); Badge badgeOne = new Badge(5, new List <string>() { "A1", "A7" }); _repo.AddBadge(badge); _repo.AddBadge(badgeOne); }
public void SeedBadges() { Badge badge1 = new Badge(12345, new List <string> { "A7" }); Badge badge2 = new Badge(22345, new List <string> { "A1", "A4", "B1", "B2" }); Badge badge3 = new Badge(32345, new List <string> { "A4", "A5" }); _repo.AddBadge(badge1); _repo.AddBadge(badge2); _repo.AddBadge(badge3); }
//1 - add public void AddABadge() { Console.Clear(); Badge entry = new Badge(); entry.DoorAccess = new List <string>(); Console.WriteLine("What is the number on the badge?"); entry.BadgeId = int.Parse(Console.ReadLine()); Console.WriteLine("List a door that it needs access to:"); string doorAccess = (Console.ReadLine()); int prevCount = entry.DoorAccess.Count; entry.DoorAccess.Add(doorAccess); int afterCount = entry.DoorAccess.Count; if (afterCount > prevCount) { Console.WriteLine("door successfully added!"); } else { Console.WriteLine("could not add door."); } Console.WriteLine("Any other doors(y/n)?"); string answer = Console.ReadLine().ToLower(); while (answer == "y") { Console.WriteLine("List a door that it needs access to:"); entry.DoorAccess.Add(Console.ReadLine()); Console.WriteLine("Any other doors(y/n)?"); answer = Console.ReadLine().ToLower(); } _badgeRepo.AddBadge(entry); Console.Clear(); Menu(); }
public void AddToRepo_ShouldGetCorrectBool()//Create { //Arrange Badge badge = new Badge(01); Badge_Repo repo = new Badge_Repo(); //Act bool addResult = repo.AddBadge(badge); //Assert Assert.IsTrue(addResult); }
public void GetBadges_ShouldReturnCorrectCollection() //Read { //Arrange Badge badge = new Badge(001); Badge_Repo repo = new Badge_Repo(); repo.AddBadge(badge); //Act Dictionary <int, List <string> > badges = repo.GetAllBadges(); bool hasBadges = badges.ContainsKey(badge.BadgeID); //Assert Assert.IsTrue(hasBadges); }
public void GetBadgeByID_ShouldReturnCorrectBadge() //Read { //Arrange Badge badge = new Badge(001, new List <string> { "A1", "A2" }); Badge_Repo repo = new Badge_Repo(); repo.AddBadge(badge); int badgeID = 001; //Act Badge searchResult = repo.GetABadgeByID(badgeID); //Assert Assert.AreEqual(searchResult.BadgeID, badgeID); }
private void CreateNewBadge() { Console.Clear(); List <string> doorNames = new List <string>(); Console.WriteLine("What is the badge ID number:"); string inputAsInt = Console.ReadLine(); int iDAsInt = int.Parse(inputAsInt); Console.WriteLine("What doors does this badge access?"); string doorOne = Console.ReadLine(); doorNames.Add(doorOne); Console.WriteLine("Would you like to add another door?"); string input = Console.ReadLine(); switch (input) { case "Y": case "Yes": case "yes": case "y": Console.WriteLine("What door does this badge access?"); string doorTwo = Console.ReadLine(); doorNames.Add(doorTwo); Console.WriteLine("Would you like to add a third door?"); string input2 = Console.ReadLine(); if (input2 == "y" || input2 == "Y") { Console.WriteLine("What is the name of this door?"); string doorThree = Console.ReadLine(); doorNames.Add(doorThree); } break; case "N": case "No": case "no": case "n": default: break; } _badgeRepo.AddBadge(iDAsInt, doorNames); }
public void DeleteBadge_ShouldReturnTrue() //Delete { //Arrange Badge badge = new Badge(001, new List <string> { "A1", "A2" }); Badge_Repo repo = new Badge_Repo(); repo.AddBadge(badge); int badgeID = 001; //Act Badge oldBadge = repo.GetABadgeByID(badgeID); bool removeResult = repo.DeleteBadge(oldBadge); //Assert Assert.IsTrue(removeResult); }
public void UpdateExistingBadge_ShouldReturnTrue() //Update { //Arrange Badge oldBadge = new Badge(001, new List <string> { "A1", "A2" }); Badge newBadge = new Badge(001, new List <string> { "A2", "A3", "B5" }); Badge_Repo repo = new Badge_Repo(); repo.AddBadge(oldBadge); //Act bool updateResult = repo.UpdateExistingBadge(oldBadge.BadgeID, newBadge); //Assert Assert.IsTrue(updateResult); }