mirror of https://github.com/winsw/winsw
Tests: Add ExamplesTests and fix the issues in the code
parent
4db3266125
commit
c0d2d0b6e3
|
@ -18,12 +18,12 @@
|
|||
-->
|
||||
|
||||
<!--
|
||||
- This is a sample configuration of the Windows Service Wrapper.
|
||||
- This configuration file should be placed near the WinSW executable, the name should be the same.
|
||||
- E.g. for myapp.exe the configuration file name should be myapp.xml
|
||||
-
|
||||
- You can find more information about the parameters here: https://github.com/kohsuke/winsw/blob/master/doc/xmlConfigFile.md
|
||||
-->
|
||||
This is a sample configuration of the Windows Service Wrapper.
|
||||
This configuration file should be placed near the WinSW executable, the name should be the same.
|
||||
E.g. for myapp.exe the configuration file name should be myapp.xml
|
||||
|
||||
You can find more information about the parameters here: https://github.com/kohsuke/winsw/blob/master/doc/xmlConfigFile.md
|
||||
-->
|
||||
<configuration>
|
||||
|
||||
<!--
|
||||
|
@ -148,9 +148,9 @@ SECTION: Executable management
|
|||
Additional arguments, which should be passed to the stop executable during termination.
|
||||
This OPTION also enables termination of the executable via stop executable
|
||||
-->
|
||||
<!--<stoparguments>--stop true</stoparguments>-->
|
||||
|
||||
<!--
|
||||
<stoparguments>-stop true</stoparguments>-->
|
||||
-->
|
||||
<!--
|
||||
SECTION: Service management
|
||||
-->
|
||||
|
@ -205,7 +205,9 @@ SECTION:Logging
|
|||
Sets a custom logging directory for all logs being produced by the service wrapper
|
||||
Default value: Directory, which contains the executor
|
||||
-->
|
||||
<logpath></logpath>
|
||||
<!--
|
||||
<logpath>%BASE%\logs</logpath>
|
||||
-->
|
||||
|
||||
<!--
|
||||
OPTION: log
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace winsw.Configuration
|
|||
// Installation
|
||||
public bool AllowServiceAcountLogonRight { get { return false; } }
|
||||
public string ServiceAccountPassword { get { return null; } }
|
||||
public string ServiceAccountUser { get { return null; } }
|
||||
public string ServiceAccountUser { get { return "NULL\\NULL"; } }
|
||||
public List<winsw.Native.SC_ACTION> FailureActions { get { return new List<winsw.Native.SC_ACTION>(); } }
|
||||
public TimeSpan ResetFailureAfter { get { return TimeSpan.FromDays(1); } }
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ using System.Xml;
|
|||
using WMI;
|
||||
namespace winsw.Configuration
|
||||
{
|
||||
interface IWinSWConfiguration
|
||||
public interface IWinSWConfiguration
|
||||
{
|
||||
//TODO: Document the parameters && refactor
|
||||
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using winsw;
|
||||
using winswTests.Util;
|
||||
|
||||
namespace winswTests.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// Tests example configuration files.
|
||||
/// The test uses a relative path to example files, which is based on the current project structure.
|
||||
/// </summary>
|
||||
[TestFixture]
|
||||
class ExamplesTest
|
||||
{
|
||||
|
||||
[Test]
|
||||
public void allOptionsConfigShouldDeclareDefaults()
|
||||
{
|
||||
ServiceDescriptor d = doLoad("allOptions");
|
||||
ServiceDescriptorAssert.AssertAllOptionalPropertiesAreDefault(d);
|
||||
}
|
||||
|
||||
private ServiceDescriptor doLoad(string exampleName) {
|
||||
var dir = Directory.GetCurrentDirectory();
|
||||
string path = dir + "\\..\\..\\..\\..\\..\\examples\\" + exampleName + ".xml";
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
throw new FileNotFoundException("Cannot find the XML file " + path, path);
|
||||
}
|
||||
XmlDocument dom = new XmlDocument();
|
||||
dom.Load(path);
|
||||
return new ServiceDescriptor(dom);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -55,6 +55,7 @@
|
|||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Configuration\ExamplesTest.cs" />
|
||||
<Compile Include="Extensions\ExtensionTestBase.cs" />
|
||||
<Compile Include="Extensions\RunawayProcessKillerTest.cs" />
|
||||
<Compile Include="Extensions\SharedDirectoryMapperTest.cs" />
|
||||
|
|
Loading…
Reference in New Issue