コード例 #1
0
        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);
        }
コード例 #2
0
        public void ViewAll()
        {
            Console.Clear();
            Header();
            Console.WriteLine("=-=-=-=- View All Badges -=-=-=-=");
            Console.WriteLine();
            Console.WriteLine("Badge#           Door Access:");
            Dictionary <int, List <string> > badges = _repo.GetAllBadges();

            foreach (KeyValuePair <int, List <string> > badge in badges)
            {
                string doorsResult = string.Join(",", badge.Value);
                Console.WriteLine($"{badge.Key}            {doorsResult}");
            }
            Console.WriteLine();
            Console.WriteLine("Press any key to return to main menu.");
            Console.ReadKey();
        }