diff --git a/src/Test/winswTests/Util/ConfigXmlBuilder.cs b/src/Test/winswTests/Util/ConfigXmlBuilder.cs
new file mode 100644
index 0000000..486e0cf
--- /dev/null
+++ b/src/Test/winswTests/Util/ConfigXmlBuilder.cs
@@ -0,0 +1,75 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using winsw;
+
+namespace winswTests.Util
+{
+ ///
+ /// Configuration XML builder, which simplifies testing of WinSW Configuration file.
+ ///
+ class ConfigXmlBuilder
+ {
+ public string Name { get; set; }
+ public string Id { get; set; }
+ public string Description { get; set; }
+ public string Executable { get; set; }
+
+ private List configEntries;
+
+ private ConfigXmlBuilder()
+ {
+ configEntries = new List();
+ }
+
+ public static ConfigXmlBuilder create(string id = null, string name = null,
+ string description = null, string executable = null)
+ {
+ var config = new ConfigXmlBuilder();
+ config.Id = id ?? "myapp";
+ config.Name = name ?? "MyApp Service";
+ config.Description = description ?? "MyApp Service (powered by WinSW)";
+ config.Executable = executable ?? "%BASE%\\myExecutable.exe";
+ return config;
+ }
+
+ public string ToXMLString(bool dumpConfig = false)
+ {
+ StringBuilder str = new StringBuilder();
+ str.Append("\n");
+ str.AppendFormat(" {0}\n", Id);
+ str.AppendFormat(" {0}\n", Name);
+ str.AppendFormat(" {0}\n", Description);
+ str.AppendFormat(" {0}\n", Executable);
+ foreach (String entry in configEntries)
+ {
+ // We do not care much about pretty formatting here
+ str.AppendFormat(" {0}\n", entry);
+ }
+ str.Append("\n");
+ string res = str.ToString();
+ if (dumpConfig)
+ {
+ Console.Out.WriteLine("Produced config:");
+ Console.Out.WriteLine(res);
+ }
+ return res;
+ }
+
+ public ServiceDescriptor ToServiceDescriptor(bool dumpConfig = false)
+ {
+ return ServiceDescriptor.FromXML(ToXMLString(dumpConfig));
+ }
+
+ public ConfigXmlBuilder WithRawEntry(string entry)
+ {
+ configEntries.Add(entry);
+ return this;
+ }
+
+ public ConfigXmlBuilder WithTag(string tagName, string value)
+ {
+ return WithRawEntry(String.Format("<{0}>{1}{0}>", tagName, value));
+ }
+ }
+}
diff --git a/src/Test/winswTests/winswTests.csproj b/src/Test/winswTests/winswTests.csproj
index f3a6ace..7292731 100644
--- a/src/Test/winswTests/winswTests.csproj
+++ b/src/Test/winswTests/winswTests.csproj
@@ -63,6 +63,7 @@
+