예제 #1
0
        public void AuthorizationHelpers_Matches_ResourceIsNullOrEmpty_False()
        {
            //------------Setup for test--------------------------
            var securityPermission = new WindowsGroupPermission {
                IsServer = false, ResourceName = "CATEGORY\\TEST2"
            };

            //------------Execute Test---------------------------
            var authorized = securityPermission.Matches((WebName)null);

            //------------Assert Results-------------------------
            Assert.IsTrue(authorized);
        }
        public void AuthorizationHelpers_Matches_SecurityPermissionIsServer_True()
        {
            //------------Setup for test--------------------------
            var securityPermission = new WindowsGroupPermission {
                IsServer = true
            };

            //------------Execute Test---------------------------
            var authorized = securityPermission.Matches(null);

            //------------Assert Results-------------------------
            Assert.IsTrue(authorized);
        }
예제 #3
0
        public void AuthorizationHelpers_Matches_ResourceIsStringAndDoesNotHaveSecurityPermissions_False()
        {
            //------------Setup for test--------------------------
            const string ResourceName       = "Test";
            var          securityPermission = new WindowsGroupPermission {
                IsServer = false, ResourceName = "CATEGORY\\TEST2"
            };

            //------------Execute Test---------------------------
            var authorized = securityPermission.Matches(ResourceName);

            //------------Assert Results-------------------------
            Assert.IsFalse(authorized);
        }
예제 #4
0
        public void AuthorizationHelpers_Matches_ResourceIsGuidAndDoesNotHaveSecurityPermissions_False()
        {
            //------------Setup for test--------------------------
            var resourceID         = Guid.NewGuid();
            var securityPermission = new WindowsGroupPermission {
                IsServer = false, ResourceID = Guid.NewGuid()
            };

            //------------Execute Test---------------------------
            var authorized = securityPermission.Matches(resourceID.ToString());

            //------------Assert Results-------------------------
            Assert.IsFalse(authorized);
        }
예제 #5
0
        public void AuthorizationHelpers_Matches_ResourceIsGuidAndHasSecurityPermission_True()
        {
            //------------Setup for test--------------------------
            var resourceID         = Guid.NewGuid();
            var securityPermission = new WindowsGroupPermission {
                IsServer = false, ResourceID = resourceID
            };

            //------------Execute Test---------------------------
            var authorized = securityPermission.Matches(resourceID);

            //------------Assert Results-------------------------
            Assert.IsTrue(authorized);
        }