ValidateAndLoadXMLSchema test added

pull/460/merge^2
Buddhika Chathuranga 2020-04-22 11:30:32 +05:30
parent 17524cd391
commit a9b5c50a67
2 changed files with 25 additions and 1 deletions

View File

@ -101,7 +101,7 @@ namespace winsw
this.dom = dom;
}
private void ValidateAndLoadXmlSchema()
public void ValidateAndLoadXmlSchema()
{
XmlReaderSettings settings = new XmlReaderSettings();

View File

@ -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();
}
}
}
}