public void AddBadges_Test() { //Arrange Badge_Repository _repo = new Badge_Repository(); Dictionary <int, List <string> > test = new Dictionary <int, List <string> >(); List <string> testList = new List <string>(); //Act bool confirmAdd = _repo.AddToDictionary(1, testList); //Assert Assert.IsTrue(confirmAdd); }
public void DeleteAllDoors_Test() { //Arrange Badge_Repository _repo = new Badge_Repository(); List <string> testList = new List <string>(); testList.Add("list"); _repo.AddToDictionary(1, testList); //Act bool testValue = _repo.DeleteDoorValues(1); //Assert Assert.IsTrue(testValue); }
public void GetDoorByID_Test() { //Arrange Badge_Repository _repo = new Badge_Repository(); List <string> testList = new List <string>(); testList.Add("list"); _repo.AddToDictionary(1, testList); //Act List <string> testListTwo = _repo.GetDoorByID(1); bool confirm = testListTwo.Contains("list"); //Assert Assert.IsTrue(confirm); }
public void GetList_Test() { //Arrange Badge_Repository _repo = new Badge_Repository(); List <string> testList = new List <string>(); _repo.AddToDictionary(1, testList); //Act Dictionary <int, List <string> > dict = _repo.GetList(); bool confirmHas = dict.ContainsKey(1); bool confirmValue = dict.ContainsValue(testList); //Assert Assert.IsTrue(confirmHas); Assert.IsTrue(confirmValue); }
public void TestMethod4_ReturnBadges() { //Arrange Badge_Repository repo = new Badge_Repository(); List <string> iDOne = new List <string> { "A22", "A23", "A42" }; repo.AddEntry(10101, iDOne); //Act List <string> returnedStringList = repo.ReturnBadges(); //Assert Assert.IsNotNull(returnedStringList); }
public void TestMethod2_ReturnDoorSet() { //Arrange Badge_Repository repo = new Badge_Repository(); List <string> iDOne = new List <string> { "A22", "A23", "A42" }; repo.AddEntry(10101, iDOne); //Act List <string> returnedStringList = repo.ReturnDoorSet(10101); //Assert Assert.AreEqual(returnedStringList, iDOne); }
private void EditBadge() { Dictionary <int, Badge> _badgesList = _badgeRepo.GetBadgesList(); Badge_Repository _repo = _badgeRepo; Console.WriteLine("What is the badge number to be updated?: "); string input1AsString = Console.ReadLine(); int badgeToUpdateID = int.Parse(input1AsString); if (_badgesList.ContainsKey(badgeToUpdateID)) { Badge badgeToUpdate = _repo.GetBadgeByID(badgeToUpdateID); Console.WriteLine("Badge # " + badgeToUpdateID + " has acces to doors :"); for (int i = 0; i < badgeToUpdate.DoorList.Count; i++) { Console.Write(" " + badgeToUpdate.DoorList[i]); } Console.WriteLine(""); Console.WriteLine("Please pick an option:"); Console.WriteLine("1. Remove a door"); Console.WriteLine("2. Add a door"); string input2AsString = Console.ReadLine(); int input2 = int.Parse(input2AsString); if (input2 == 1) { Console.Write("Which door would you like to remove? "); string doorToRemove = Console.ReadLine(); badgeToUpdate.DoorList.Remove(doorToRemove); } else if (input2 == 2) { Console.WriteLine("What door would you like to add? "); string doorToAdd = Console.ReadLine(); badgeToUpdate.DoorList.Add(doorToAdd); } } }
public void TestMethod1_DeleteDoor() { //Arrange Badge_Repository repo = new Badge_Repository(); List <string> iDOne = new List <string> { "A22", "A23", "A42" }; repo.AddEntry(10101, iDOne); repo.AddDoor(10101, "A44"); string firstDoor = "A22"; //Act int beforeCount = iDOne.Count; repo.DeleteDoor(10101, firstDoor); int actual = iDOne.Count; int expected = beforeCount - 1; //Assert Assert.AreEqual(expected, actual); }