mirror of https://github.com/winsw/winsw
				
				
				
			ValidateAndLoadXMLSchema test added
							parent
							
								
									17524cd391
								
							
						
					
					
						commit
						a9b5c50a67
					
				| 
						 | 
				
			
			@ -101,7 +101,7 @@ namespace winsw
 | 
			
		|||
            this.dom = dom;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void ValidateAndLoadXmlSchema()
 | 
			
		||||
        public void ValidateAndLoadXmlSchema()
 | 
			
		||||
        {
 | 
			
		||||
            XmlReaderSettings settings = new XmlReaderSettings();
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,9 @@
 | 
			
		|||
using System;
 | 
			
		||||
using System.Diagnostics;
 | 
			
		||||
using System.IO;
 | 
			
		||||
using NUnit.Framework;
 | 
			
		||||
using winsw;
 | 
			
		||||
using winsw.Native;
 | 
			
		||||
using winswTests.Util;
 | 
			
		||||
using WMI;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -441,5 +443,27 @@ $@"<service>
 | 
			
		|||
            var sd = bldr.ToServiceDescriptor();
 | 
			
		||||
            Assert.That(sd.DelayedAutoStart, Is.EqualTo(enabled));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        [Test]
 | 
			
		||||
        public void ValidateAndLoadXmlSchemaTest()
 | 
			
		||||
        {
 | 
			
		||||
            const string seedXml = "<service>" +
 | 
			
		||||
  "<id>myapp</id> " +
 | 
			
		||||
  "<name>MyApp Service (powered by WinSW)</name>" +
 | 
			
		||||
  "<description>This service is a service created from a minimal configuration</description>" +
 | 
			
		||||
"</service>";
 | 
			
		||||
 | 
			
		||||
            var serviceDescriptor = ServiceDescriptor.FromXML(seedXml);
 | 
			
		||||
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                serviceDescriptor.ValidateAndLoadXmlSchema();
 | 
			
		||||
                Assert.Fail();
 | 
			
		||||
            }
 | 
			
		||||
            catch (FileNotFoundException)
 | 
			
		||||
            {
 | 
			
		||||
                Assert.Pass();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue