Пример #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));
        }