Exemple #1
0
 public void ListOfBadgesAndDoors_Test()
 {
     BadgesContent listItems = new BadgesContent(22345, new List <string> {
         "A1", "A4", "B1", "B2"
     });
     Dictionary <int, List <string> > unitTestDict = _repo.ListOfBadgesAndDoors();
 }
        private void UpdatedExistingContent()
        {
            string badgeOptions = null;

            if (badgeOptions == "y")
            {
                Console.WriteLine("what BadgeOption content would you would like to Update?:\n" +
                                  "1.DoorListOptions" +
                                  "2.BadgeID" +
                                  "3.BadgeTile");

                //DoorList
                BadgesContent newContent = new BadgesContent();
                Console.WriteLine("Enter the MealName");
                newContent.DoorList = Console.ReadLine();
                //BadgeID
                Console.WriteLine("Enter the description from the content:");
                newContent.BadgeID = Console.ReadLine();
                //Badge Title
                Console.WriteLine("Enter the ingredients  for the content (Burgers, Salads, Fries, Desserts, Coffee etc):");
                newContent.BadgeTitle = Console.ReadLine();

                _contentRepo.Equals(newContent);
            }
        }
Exemple #3
0
        public void CreateNewBadge()
        {
            Console.Clear();

            int           badgeId = 0;
            List <string> doors   = new List <string>();

            Console.WriteLine("What is the badge number?");
            badgeId = int.Parse(Console.ReadLine());

            Console.WriteLine("Please advise the door that this badge can access?");
            string doorInput = Console.ReadLine();

            doors.Add(doorInput);

            Console.WriteLine("Your door access has been added");
            Console.WriteLine("Do you waned to add another door?\n" +
                              "Enter y for Yes\n" +
                              "Enter n for No");
            string userInput = Console.ReadLine().ToLower();

            if (userInput == "y")
            {
                CreateNewBadge();
            }
            else
            {
                Console.WriteLine("Press any key to return to the menu...");
                Console.ReadLine();
            }
            Console.ReadKey();
            BadgesContent newBadge = new BadgesContent(badgeId, doors);

            _repo.CreateNewBadge(newBadge);
        }
        private void CreateNewContent()
        {
            Console.Clear();
            BadgesContent content = new BadgesContent();

            // BadgeNme
            Console.WriteLine("Please enter the employee Title content in the prompt: ");
            content.BadgeTitle = Console.ReadLine();
            Console.WriteLine("Select a BadgeOptions:/n" +
                              "1.Name " +
                              "2.Departement" +
                              "3.Postion.");
            Console.WriteLine("Please enter the your postion Title: ");
            content.BadgeTitle = Console.ReadLine();
            Console.WriteLine("Please enter a valid number between 1 and 3. \n" +
                              "Press any key to continue....");
            Console.ReadKey();
            Console.WriteLine("Please select badge option:/" +
                              "1.NewBadge/n" +
                              "2.BadgeUpdate/n" +
                              "3.BadgeSearch");

            string BadgeName = Console.ReadLine();

            _contentRepo.Equals(content);
        }
        private void RemoveContentFromList()
        {
            Console.WriteLine("Which Badge information would you like to remove?");
            List <BadgesContent> contentList = new List <BadgesContent>();
            int count = 0;

            foreach (BadgesContent content in contentList)
            {
                count++;
                Console.WriteLine($"{count}{content.BadgeID}");
            }

            var targetContentId = int.Parse(Console.ReadLine());
            int targetIndex     = targetContentId - 1;

            if (targetIndex >= 0 && targetIndex < contentList.Count)
            {
                BadgesContent desiredContent = contentList[targetIndex];
                if (desiredContent == contentList[targetIndex])
                {
                    ;
                }
                {
                    Console.WriteLine($"{desiredContent.BadgeID} successfully removed.");
                }
            }
            else
            {
                Console.WriteLine("No content has that ID");
            }
            Console.WriteLine("Press any key to continue....");
            Console.ReadKey();
        }
 public void CArrange()
 {
     _repository = new BadgesRepository();
     _content    = new BadgesContent(12345, new List <DoorNames> {
         DoorNames.A3, DoorNames.B2
     });
     _repository.AddNewBadgeToDictionary(_content);
 }
        public void AddNewBadgeToDictionaryTest()
        {
            List <DoorNames> doorNameList = new List <DoorNames>();
            BadgesContent    badge        = new BadgesContent();
            BadgesRepository repository   = new BadgesRepository();

            bool addBadge = repository.AddNewBadgeToDictionary(badge);

            Assert.IsTrue(addBadge);
        }
Exemple #8
0
        public void CreateNewBadge_Test()
        {
            //arrange
            BadgesContent content = new BadgesContent();

            //act
            bool addBadge = _repo.CreateNewBadge(content);

            //assert
            Assert.IsTrue(addBadge);
        }
Exemple #9
0
        public void RemoveVehicle_Test()
        {
            //Arrange
            BadgesContent _contentRepo = new BadgesContent();
            BadgesContent vehicleType  = new BadgesContent();
            //ACT
            bool removeResult = _contentRepo.Equals(vehicleType);

            //ASSERT
            Assert.IsTrue(removeResult);
        }
Exemple #10
0
        public void UpdateExistingContent_ShouldReturnTrue()
        {
            //Arrange
            BadgesContent newContent  = new BadgesContent();
            BadgesContent vehicleType = new BadgesContent();
            //ACT
            bool updatedResult = newContent.Equals(vehicleType);

            //ASSERT
            Assert.IsTrue(updatedResult);
        }
Exemple #11
0
        private void SeedBadges()
        {
            BadgesContent newBadgeOne = new BadgesContent(12345, new List <DoorNames> {
                DoorNames.A1, DoorNames.B1, DoorNames.C1
            });
            BadgesContent newBadgeTwo = new BadgesContent(11111, new List <DoorNames> {
                DoorNames.A2, DoorNames.B2, DoorNames.C2
            });

            _badgesRepo.AddNewBadgeToDictionary(newBadgeOne);
            _badgesRepo.AddNewBadgeToDictionary(newBadgeTwo);
        }
Exemple #12
0
        public void addBadge_Test()
        {
            //Arrange
            BadgesContent _contentRepo = new BadgesContent();
            BadgesContent carName      = new BadgesContent();

            //ACT
            bool addResult = _contentRepo.Equals(carName);

            //Assert
            Assert.IsTrue(addResult);
        }
Exemple #13
0
        public void BadgeSeed()
        {
            BadgesContent badgeOne = new BadgesContent(12345, new List <string> {
                "A7"
            });
            BadgesContent badgeTwo = new BadgesContent(22345, new List <string> {
                "A1", "A4", "B1", "B2"
            });
            BadgesContent badgeThree = new BadgesContent(32345, new List <string> {
                "A4", "A5"
            });

            _repo.CreateNewBadge(badgeOne);
            _repo.CreateNewBadge(badgeTwo);
            _repo.CreateNewBadge(badgeThree);
        }
        public void EUpdateDoorsOnBadgeTest()
        {
            BadgesContent badge = new BadgesContent(12345, new List <DoorNames> {
                DoorNames.A3, DoorNames.B2, DoorNames.C3
            });

            List <DoorNames> oldDoorNameList = _repository.GetDoorsByBadgeID(badge.BadgeID);

            Assert.AreEqual(oldDoorNameList.Count, 2);

            bool updateDoors = _repository.UpdateDoorsOnBadge(12345, badge.DoorNameList);

            List <DoorNames> newDoorNameList = _repository.GetDoorsByBadgeID(badge.BadgeID);

            Assert.AreEqual(newDoorNameList.Count, 3);
        }
 private void DisplayContent(BadgesContent content)
 {
     Console.WriteLine($"Title: {content.BadgeID} \n" +
                       $"Description: {content.BadgeTitle} \n" +
                       $"Genre: {content.DoorList} \n");
 }
Exemple #16
0
        private void AddBadge()
        {
            Console.Clear();
            BadgesContent badge = new BadgesContent();

            Console.WriteLine("Please enter the badge number for the new badge:");

            badge.BadgeID = Int32.Parse(Console.ReadLine());

            List <DoorNames> doorNameList = new List <DoorNames>();

            for (int i = 0; i < 20; i++)
            {
                Console.WriteLine("Please choose a door it needs access to:\n" +
                                  "A1\n" +
                                  "A2\n" +
                                  "A3\n" +
                                  "B1\n" +
                                  "B2\n" +
                                  "B3\n" +
                                  "C1\n" +
                                  "C2\n" +
                                  "C3\n");
                string doorNameWant = Console.ReadLine().ToLower();

                switch (doorNameWant)
                {
                case "a1":
                    if (doorNameList.Contains(DoorNames.A1))
                    {
                        Console.WriteLine("This badge already has access to that door.");
                        AddBadge();
                    }
                    else
                    {
                        doorNameList.Add(DoorNames.A1);
                    }
                    break;

                case "a2":
                    if (doorNameList.Contains(DoorNames.A2))
                    {
                        Console.WriteLine("This badge already has access to that door.");
                        AddBadge();
                    }
                    else
                    {
                        doorNameList.Add(DoorNames.A2);
                    }
                    break;

                case "a3":
                    if (doorNameList.Contains(DoorNames.A3))
                    {
                        Console.WriteLine("This badge already has access to that door.");
                        AddBadge();
                    }
                    else
                    {
                        doorNameList.Add(DoorNames.A3);
                    }
                    break;

                case "b1":
                    if (doorNameList.Contains(DoorNames.B1))
                    {
                        Console.WriteLine("This badge already has access to that door.");
                        AddBadge();
                    }
                    else
                    {
                        doorNameList.Add(DoorNames.B1);
                    }
                    break;

                case "b2":
                    if (doorNameList.Contains(DoorNames.B2))
                    {
                        Console.WriteLine("This badge already has access to that door.");
                        AddBadge();
                    }
                    else
                    {
                        doorNameList.Add(DoorNames.B2);
                    }
                    break;

                case "b3":
                    if (doorNameList.Contains(DoorNames.B3))
                    {
                        Console.WriteLine("This badge already has access to that door.");
                        AddBadge();
                    }
                    else
                    {
                        doorNameList.Add(DoorNames.B3);
                    }
                    break;

                case "c1":
                    if (doorNameList.Contains(DoorNames.C1))
                    {
                        Console.WriteLine("This badge already has access to that door.");
                        AddBadge();
                    }
                    else
                    {
                        doorNameList.Add(DoorNames.C1);
                    }
                    break;

                case "c2":
                    if (doorNameList.Contains(DoorNames.C2))
                    {
                        Console.WriteLine("This badge already has access to that door.");
                        AddBadge();
                    }
                    else
                    {
                        doorNameList.Add(DoorNames.C2);
                    }
                    break;

                case "c3":
                    if (doorNameList.Contains(DoorNames.C3))
                    {
                        Console.WriteLine("This badge already has access to that door.");
                        AddBadge();
                    }
                    else
                    {
                        doorNameList.Add(DoorNames.C3);
                    }
                    break;

                default:
                    AddBadge();
                    break;
                }



                Console.WriteLine($"You have added {doorNameWant}. Do you want to add another door?\n" +
                                  $"Type y or n\n");
                string anotherDoor = Console.ReadLine().ToLower();
                if (anotherDoor == "n")
                {
                    break;
                }

                badge.DoorNameList = doorNameList;
            }

            _badgesRepo.AddNewBadgeToDictionary(badge);
            RunMenu();
        }