diff --git a/TGServerService/Service.cs b/TGServerService/Service.cs index b9d8547453..13b1605af9 100644 --- a/TGServerService/Service.cs +++ b/TGServerService/Service.cs @@ -214,8 +214,6 @@ namespace TGServerService { var newVersion = Config.SettingsVersion; Config.Upgrade(); - - PrePrepConfig(); for (var oldVersion = Config.SettingsVersion; oldVersion < newVersion; ++oldVersion) MigrateSettings(oldVersion); @@ -225,6 +223,8 @@ namespace TGServerService Config.UpgradeRequired = false; Config.Save(); } + + PrePrepConfig(); } /// diff --git a/TGServiceTests/Service/TestService.cs b/TGServiceTests/Service/TestService.cs index 43d6f277f6..8c19056596 100644 --- a/TGServiceTests/Service/TestService.cs +++ b/TGServiceTests/Service/TestService.cs @@ -19,10 +19,9 @@ namespace TGServerService.Tests } /// - /// Test and can execute successfully + /// Starts and stops a /// - [TestMethod] - public void TestStartupAndShutdown() + void StartStopServiceBasic() { using (var S = new ServiceAccessor()) { @@ -30,6 +29,15 @@ namespace TGServerService.Tests S.FakeStop(); } } + + /// + /// Test and can execute successfully + /// + [TestMethod] + public void TestStartupAndShutdown() + { + StartStopServiceBasic(); + } /// /// Test and can execute successfully with a commandline port override @@ -37,11 +45,29 @@ namespace TGServerService.Tests [TestMethod] public void TestCommandLinePortSet() { + Properties.Settings.Default.RemoteAccessPort = 11111; using (var S = new ServiceAccessor()) { S.FakeStart(new string[] { "-port", "36785" }); S.FakeStop(); } + Assert.AreEqual(Properties.Settings.Default.RemoteAccessPort, 36785); + } + + /// + /// Test that the .NET config is always initialized regardless of + /// + [TestMethod] + public void TestNETConfigIsAlwaysPrepped() + { + Properties.Settings.Default.UpgradeRequired = true; + Properties.Settings.Default.InstancePaths = null; + StartStopServiceBasic(); + Assert.IsNotNull(Properties.Settings.Default.InstancePaths); + Properties.Settings.Default.UpgradeRequired = false; + Properties.Settings.Default.InstancePaths = null; + StartStopServiceBasic(); + Assert.IsNotNull(Properties.Settings.Default.InstancePaths); } } }