コード例 #1
0
        public void NewBadge_ShouldReturnTrue()
        {
            Badges     test = new Badges();
            BadgesRepo repo = new BadgesRepo();


            bool wasAdded = repo.NewBadge(test);

            Assert.IsTrue(wasAdded);
        }
コード例 #2
0
        private void AddABadge()
        {
            Console.Clear();
            Badges AddABadge = new Badges();

            Console.WriteLine("What is the number on the badge:");
            string badgeIdAsSring = Console.ReadLine();

            AddABadge.BadgeID = int.Parse(badgeIdAsSring);


            bool          needsMoreDoorsAccessed = true;
            List <string> accessibleDoors        = new List <string>();

            do
            {
                Console.WriteLine("List a door that it needs access to: ");
                string whatDoorNeedsAccess = Console.ReadLine();
                accessibleDoors.Add(whatDoorNeedsAccess);

                Console.WriteLine("Any other doors(y/n)?");
                string userInput = Console.ReadLine();


                if (userInput.ToLower() == "y")
                {
                    needsMoreDoorsAccessed = true;
                }
                else
                {
                    AddABadge.doorAccess   = accessibleDoors;
                    needsMoreDoorsAccessed = false;
                }
            }while (needsMoreDoorsAccessed);


            _badgeRepo.NewBadge(AddABadge);
            Console.WriteLine("Please press any key to coninute.");
            Console.ReadLine();
        }