public void EditBadgeTest_ShouldRemoveDoors()
        {
            var _badgeRepo = new Badges_Repo();
            var badge      = new Badge()
            {
                BadgeID   = "123",
                DoorNames = new List <String>()
                {
                    "door1",
                    "door2"
                }
            };

            _badgeRepo.AddBadge(badge);

            var updatedBadge = new Badge()
            {
                BadgeID   = "123",
                DoorNames = new List <String>()
                {
                    "door1",
                }
            };

            _badgeRepo.UpdateBadge(updatedBadge);
            var testBadge = _badgeRepo.GetBadge("123");

            Assert.AreEqual(testBadge.DoorNames.Count, 1);
        }
Esempio n. 2
0
        private void AddNewBadge()
        {
            Console.Clear();
            Badge newBadge = new Badge();

            newBadge.DoorNames = new List <String>();

            Console.WriteLine("What is the number on the badge?");
            newBadge.BadgeID = Console.ReadLine();

            //add access to door
            DoorAccessLoop(newBadge);
            _repo.AddBadge(newBadge);
            Console.WriteLine($"Badge {newBadge.BadgeID} added.");
        }
        public void AddBadgeTest_ShouldAddBadge()
        {
            var _badgeRepo = new Badges_Repo();
            var badge      = new Badge()
            {
                BadgeID   = "123",
                DoorNames = new List <String>()
                {
                    "door1",
                    "door2"
                }
            };
            var isAdded = _badgeRepo.AddBadge(badge);

            Assert.IsTrue(isAdded);
        }