Exemplo n.º 1
0
        public void Arrange()
        {
            List <string> listyList = new List <string>();

            listyList.Add("A1");
            listyList.Add("B2");
            _badgeDirectory = new BadgeRepo();
            _badge          = new Badge(1, listyList);

            _badgeDirectory.AddBadgeToDict(_badge);
        }
Exemplo n.º 2
0
        private void AddNewBadge()
        {
            Console.Clear();
            //Build a new object
            List <string> stringList = new List <string>();

            //ID Number
            Console.WriteLine("Enter the unique ID number for the Badge:");
            string badgeString = Console.ReadLine();
            int    badgeInt    = Convert.ToInt32(badgeString);

            //List of Doors
            bool keepAsking = true;

            while (keepAsking == true)
            {
                Console.WriteLine("Add the door that the badge has access to:");
                string newDoor = Console.ReadLine();
                stringList.Add(newDoor);
                Console.WriteLine("Any other doors(y/n)?");
                string yesNo = Console.ReadLine().ToLower();
                if (yesNo == "y")
                {
                    keepAsking = true;
                }
                else if (yesNo == "n")
                {
                    keepAsking = false;
                }
                else
                {
                    Console.WriteLine("Please input a valid response.");
                }
            }
            Badge newBadge = new Badge(badgeInt, stringList);

            _BadgeRepo.AddBadgeToDict(newBadge);
        }
Exemplo n.º 3
0
        public void AddToDict_ShouldGetNotNull()
        {
            //Arrange --> Setting up the Playing Field
            List <string> listyList = new List <string>();

            listyList.Add("A1");
            listyList.Add("B2");
            Badge     badge = new Badge(1, listyList);
            BadgeRepo repo  = new BadgeRepo();


            //Act --> Get/run the code we want to test
            repo.AddBadgeToDict(badge);
            Badge badgeFromDirectory = repo.GetBadgeByDictionaryKey(1);

            //Assert --> Use the assert class to verify the expected outcome.
            Assert.IsNotNull(badgeFromDirectory);
        }