コード例 #1
0
        public void BadgeB_AccessLevel3_ShouldReturnAccessDenied()
        {
            //Arrange
            var badge = new BadgeB(3);

            //Act
            var expected = "Access Denied";
            var actual   = badge.Access();

            //Assert
            Assert.AreEqual(expected, actual);
        }
コード例 #2
0
        public void BadgeB_VerifyAccess_ShouldSucceed(int level, string access)
        {
            //Act
            var badgeB = new BadgeB(level);

            Console.WriteLine(badgeB.Access());

            var expected = access;
            var actual   = badgeB.Access();

            //Assert
            Assert.AreEqual(expected, actual);
        }
コード例 #3
0
        public void CanCheckFloorAccess()
        {
            //Arrange
            var aBadge = new BadgeA(FloorAccess.One);
            var bBadge = new BadgeB(FloorAccess.Two);
            var cBadge = new BadgeC(FloorAccess.Three);
            var repo   = new BadgeRepository();

            repo.AddBadge(aBadge);
            repo.AddBadge(bBadge);
            repo.AddBadge(cBadge);

            //Act
            var actualA = repo.AccessFloor(aBadge, FloorAccess.One);
            var actualB = repo.AccessFloor(bBadge, FloorAccess.One);
            var actualC = repo.AccessFloor(cBadge, FloorAccess.Three);

            //Assert
            Assert.IsTrue(actualA);
            Assert.IsFalse(actualB);
            Assert.IsTrue(actualC);
        }