Index: Core/Components/test/Core.Components.BruTile.Test/Configurations/WellKnownTileSourceLayerConfigurationTest.cs =================================================================== diff -u -rd95413945eef87315850dbd426cdf8dcf81d4493 -r3204fdab2e01e8fcb73ca38d74adfde8fa8d369a --- Core/Components/test/Core.Components.BruTile.Test/Configurations/WellKnownTileSourceLayerConfigurationTest.cs (.../WellKnownTileSourceLayerConfigurationTest.cs) (revision d95413945eef87315850dbd426cdf8dcf81d4493) +++ Core/Components/test/Core.Components.BruTile.Test/Configurations/WellKnownTileSourceLayerConfigurationTest.cs (.../WellKnownTileSourceLayerConfigurationTest.cs) (revision 3204fdab2e01e8fcb73ca38d74adfde8fa8d369a) @@ -23,6 +23,7 @@ using BruTile; using BruTile.Predefined; using Core.Common.Gui.TestUtil.Settings; +using Core.Common.TestUtil; using Core.Components.BruTile.Configurations; using Core.Components.BruTile.IO; using Core.Components.BruTile.TestUtil; @@ -34,6 +35,9 @@ [TestFixture] public class WellKnownTileSourceLayerConfigurationTest { + private DirectoryDisposeHelper directoryDisposeHelper; + private TestSettingsHelper testSettingsHelper; + [Test] public void CreateInitializedConfiguration_InvalidKnownTileSource_ThrowNotSupportedException() { @@ -77,7 +81,7 @@ public void GivenAllAvailableKnownTileSources_WhenCreatingInitializedConfiguration_ThenConfigurationHasExpectedValues() { // Given - using (new UseCustomSettingsHelper(new TestSettingsHelper())) + using (new UseCustomSettingsHelper(testSettingsHelper)) using (new UseCustomTileSourceFactoryConfig(new WellKnownTileSourceMapData(WellKnownTileSource.BingAerial))) { foreach (KnownTileSource knownTileSource in Enum.GetValues(typeof(KnownTileSource))) @@ -100,7 +104,7 @@ { // Setup const KnownTileSource knownTileSource = KnownTileSource.BingAerial; - using (new UseCustomSettingsHelper(new TestSettingsHelper())) + using (new UseCustomSettingsHelper(testSettingsHelper)) using (new UseCustomTileSourceFactoryConfig(new WellKnownTileSourceMapData(WellKnownTileSource.BingAerial))) using (WellKnownTileSourceLayerConfiguration configuration = WellKnownTileSourceLayerConfiguration.CreateInitializedConfiguration(knownTileSource)) { @@ -124,7 +128,7 @@ public void Clone_ConfigurationDisposed_ThrowObjectDisposedException() { // Setup - using (new UseCustomSettingsHelper(new TestSettingsHelper())) + using (new UseCustomSettingsHelper(testSettingsHelper)) using (new UseCustomTileSourceFactoryConfig(new WellKnownTileSourceMapData(WellKnownTileSource.BingAerial))) { WellKnownTileSourceLayerConfiguration configuration = WellKnownTileSourceLayerConfiguration.CreateInitializedConfiguration(KnownTileSource.BingAerial); @@ -143,7 +147,7 @@ public void Initialize_InitializedTrue() { // Setup - using (new UseCustomSettingsHelper(new TestSettingsHelper())) + using (new UseCustomSettingsHelper(testSettingsHelper)) using (new UseCustomTileSourceFactoryConfig(new WellKnownTileSourceMapData(WellKnownTileSource.BingAerial))) using (WellKnownTileSourceLayerConfiguration configuration = WellKnownTileSourceLayerConfiguration.CreateInitializedConfiguration(KnownTileSource.BingAerial)) { @@ -163,7 +167,7 @@ public void Initialize_ConfigurationDisposed_ThrowObjectDisposedException() { // Setup - using (new UseCustomSettingsHelper(new TestSettingsHelper())) + using (new UseCustomSettingsHelper(testSettingsHelper)) using (new UseCustomTileSourceFactoryConfig(new WellKnownTileSourceMapData(WellKnownTileSource.BingAerial))) { WellKnownTileSourceLayerConfiguration configuration = WellKnownTileSourceLayerConfiguration.CreateInitializedConfiguration(KnownTileSource.BingAerial); @@ -178,6 +182,23 @@ } } + [OneTimeSetUp] + public void OneTimeSetUp() + { + testSettingsHelper = new TestSettingsHelper + { + ApplicationLocalUserSettingsDirectory = TestHelper.GetScratchPadPath(nameof(WellKnownTileSourceLayerConfigurationTest)) + }; + + directoryDisposeHelper = new DirectoryDisposeHelper(TestHelper.GetScratchPadPath(), nameof(WellKnownTileSourceLayerConfigurationTest)); + } + + [OneTimeTearDown] + public void OneTimeTearDown() + { + directoryDisposeHelper.Dispose(); + } + private static TestCaseData[] ValidWellKnownTileSourceToCorrespondingKnownTileSource() { return new[] Index: Core/Components/test/Core.Components.BruTile.Test/Configurations/WmtsLayerConfigurationTest.cs =================================================================== diff -u -r99f9004206bfb9de084275d749b7aeccafd6da18 -r3204fdab2e01e8fcb73ca38d74adfde8fa8d369a --- Core/Components/test/Core.Components.BruTile.Test/Configurations/WmtsLayerConfigurationTest.cs (.../WmtsLayerConfigurationTest.cs) (revision 99f9004206bfb9de084275d749b7aeccafd6da18) +++ Core/Components/test/Core.Components.BruTile.Test/Configurations/WmtsLayerConfigurationTest.cs (.../WmtsLayerConfigurationTest.cs) (revision 3204fdab2e01e8fcb73ca38d74adfde8fa8d369a) @@ -23,6 +23,7 @@ using System.Linq; using BruTile; using BruTile.Web; +using Core.Common.Gui.TestUtil.Settings; using Core.Common.TestUtil; using Core.Components.BruTile.Configurations; using Core.Components.BruTile.TestUtil; @@ -37,12 +38,14 @@ public class WmtsLayerConfigurationTest { private const string validPreferredFormat = "image/png"; + private DirectoryDisposeHelper directoryDisposeHelper; + private TestSettingsHelper testSettingsHelper; [Test] public void CreateInitializedConfiguration_CapabilitiesUrlNull_ThrowArgumentNullException() { // Call - TestDelegate call = () => WmtsLayerConfiguration.CreateInitializedConfiguration(null, "A", "images/png"); + TestDelegate call = () => WmtsLayerConfiguration.CreateInitializedConfiguration(null, "A", validPreferredFormat); // Assert string paramName = Assert.Throws(call).ParamName; @@ -53,7 +56,7 @@ public void CreateInitializedConfiguration_CapabilityIdNull_ThrowArgumentNullException() { // Call - TestDelegate call = () => WmtsLayerConfiguration.CreateInitializedConfiguration("A", null, "images/png"); + TestDelegate call = () => WmtsLayerConfiguration.CreateInitializedConfiguration("A", null, validPreferredFormat); // Assert string paramName = Assert.Throws(call).ParamName; @@ -94,6 +97,7 @@ factory.Stub(f => f.GetWmtsTileSources(url)).Return(Enumerable.Empty()); mocks.ReplayAll(); + using (new UseCustomSettingsHelper(testSettingsHelper)) using (new UseCustomTileSourceFactoryConfig(factory)) { // Call @@ -129,6 +133,7 @@ factory.Stub(f => f.GetWmtsTileSources(targetMapData.SourceCapabilitiesUrl)).Return(tileSources); mocks.ReplayAll(); + using (new UseCustomSettingsHelper(testSettingsHelper)) using (new UseCustomTileSourceFactoryConfig(factory)) { // Call @@ -164,6 +169,7 @@ factory.Stub(f => f.GetWmtsTileSources(targetMapData.SourceCapabilitiesUrl)).Return(tileSources); mocks.ReplayAll(); + using (new UseCustomSettingsHelper(testSettingsHelper)) using (new UseCustomTileSourceFactoryConfig(factory)) using (WmtsLayerConfiguration configuration = WmtsLayerConfiguration.CreateInitializedConfiguration(targetMapData.SourceCapabilitiesUrl, targetMapData.SelectedCapabilityIdentifier, @@ -202,6 +208,7 @@ factory.Stub(f => f.GetWmtsTileSources(targetMapData.SourceCapabilitiesUrl)).Return(tileSources); mocks.ReplayAll(); + using (new UseCustomSettingsHelper(testSettingsHelper)) using (new UseCustomTileSourceFactoryConfig(factory)) { WmtsLayerConfiguration configuration = WmtsLayerConfiguration.CreateInitializedConfiguration(targetMapData.SourceCapabilitiesUrl, @@ -238,6 +245,7 @@ factory.Stub(f => f.GetWmtsTileSources(targetMapData.SourceCapabilitiesUrl)).Return(tileSources); mocks.ReplayAll(); + using (new UseCustomSettingsHelper(testSettingsHelper)) using (new UseCustomTileSourceFactoryConfig(factory)) using (WmtsLayerConfiguration configuration = WmtsLayerConfiguration.CreateInitializedConfiguration(targetMapData.SourceCapabilitiesUrl, targetMapData.SelectedCapabilityIdentifier, @@ -274,6 +282,7 @@ factory.Stub(f => f.GetWmtsTileSources(targetMapData.SourceCapabilitiesUrl)).Return(tileSources); mocks.ReplayAll(); + using (new UseCustomSettingsHelper(testSettingsHelper)) using (new UseCustomTileSourceFactoryConfig(factory)) { WmtsLayerConfiguration configuration = WmtsLayerConfiguration.CreateInitializedConfiguration(targetMapData.SourceCapabilitiesUrl, @@ -290,5 +299,22 @@ } mocks.VerifyAll(); } + + [OneTimeSetUp] + public void OneTimeSetUp() + { + testSettingsHelper = new TestSettingsHelper + { + ApplicationLocalUserSettingsDirectory = TestHelper.GetScratchPadPath(nameof(WellKnownTileSourceLayerConfigurationTest)) + }; + + directoryDisposeHelper = new DirectoryDisposeHelper(TestHelper.GetScratchPadPath(), nameof(WellKnownTileSourceLayerConfigurationTest)); + } + + [OneTimeTearDown] + public void OneTimeTearDown() + { + directoryDisposeHelper.Dispose(); + } } } \ No newline at end of file