Esempio n. 1
0
        public void GetObjectData()
        {
            SecurityException se   = new SecurityException("message", typeof(string), "state");
            SerializationInfo info = new SerializationInfo(typeof(SecurityException), new FormatterConverter());

            se.GetObjectData(info, new StreamingContext(StreamingContextStates.All));
            Assert.AreEqual("state", info.GetValue("PermissionState", typeof(string)), "PermissionState");
        }
Esempio n. 2
0
        public void GetObjectData_Deny_Unrestricted()
        {
            SecurityException se   = new SecurityException("message", typeof(string), "state");
            SerializationInfo info = new SerializationInfo(typeof(SecurityException), new FormatterConverter());

            se.GetObjectData(info, new StreamingContext(StreamingContextStates.All));
            // "PermissionState" hasn't been serialized because it's access was restricted
            info.GetValue("PermissionState", typeof(string));
        }