Example #1
0
        public void AttributeList()
        {
            var contents = @"
SC-T: System.Runtime.Remoting.Activation.ActivationServices
SC-M: System.AppDomain System.AppDomain::createDomain(System.String,System.AppDomainSetup)
SSC-M: System.Boolean System.Diagnostics.Process::Start()
SSC-M: System.Void System.String::.ctor(System.Char*)";

            var expected = new[] {
                new SecurityAttributeDescriptor(
                    SecurityAttributeType.Critical,
                    TargetKind.Type,
                    "System.Runtime.Remoting.Activation.ActivationServices"),

                new SecurityAttributeDescriptor(
                    SecurityAttributeType.Critical,
                    TargetKind.Method,
                    "System.AppDomain System.AppDomain::createDomain(System.String,System.AppDomainSetup)"),

                new SecurityAttributeDescriptor(
                    SecurityAttributeType.SafeCritical,
                    TargetKind.Method,
                    "System.Boolean System.Diagnostics.Process::Start()"),

                new SecurityAttributeDescriptor(
                    SecurityAttributeType.SafeCritical,
                    TargetKind.Method,
                    "System.Void System.String::.ctor(System.Char*)")
            };

            Assert.AreEqual(expected, SecurityAttributeDescriptorParser.ParseString(contents).ToArray());
        }
Example #2
0
        public void EmptyLinesAndCommentsAreIgnored()
        {
            var contents = @"

#empty lines and comments can appear

SC-T: A.B

#anywhere

SC-T: C.D

";

            var expected = new[] {
                new SecurityAttributeDescriptor(
                    SecurityAttributeType.Critical,
                    TargetKind.Type,
                    "A.B"),

                new SecurityAttributeDescriptor(
                    SecurityAttributeType.Critical,
                    TargetKind.Type,
                    "C.D"),
            };

            Assert.AreEqual(expected, SecurityAttributeDescriptorParser.ParseString(contents).ToArray());
        }
 private IEnumerable <SecurityAttributeDescriptor> Parse(string s)
 {
     return(SecurityAttributeDescriptorParser.ParseString(s));
 }