예제 #1
0
        public void LoadXml_InvalidXml()
        {
            string      xml = "<a />";
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(xml);
            EncryptionProperty encryptionProperty = new EncryptionProperty();

            Assert.Throws <CryptographicException>(() => encryptionProperty.LoadXml(doc.DocumentElement));
        }
예제 #2
0
        public void LoadXml_ValidEncryptionPropertyXml()
        {
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(ValidXml);
            EncryptionProperty encryptionProperty = new EncryptionProperty();

            encryptionProperty.LoadXml(doc.DocumentElement);
            Assert.Equal(doc.DocumentElement, encryptionProperty.PropertyElement);
            Assert.Equal(IDValue, encryptionProperty.Id);
            Assert.Equal(TargetValue, encryptionProperty.Target);
        }
예제 #3
0
        public void GetXml_Cached()
        {
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(ValidXml);
            EncryptionProperty encryptionProperty = new EncryptionProperty();

            encryptionProperty.LoadXml(doc.DocumentElement);

            XmlElement output = encryptionProperty.GetXml();

            Assert.Equal(ValidXml, output.OuterXml);
        }
예제 #4
0
        public void LoadXml_Null()
        {
            EncryptionProperty encryptionProperty = new EncryptionProperty();

            Assert.Throws <ArgumentNullException>(() => encryptionProperty.LoadXml(null));
        }