Index: Core/Common/test/Core.Common.TestUtil.Test/Core.Common.TestUtil.Test.csproj
===================================================================
diff -u -rd6e6eadf4a2521df75b6d371bacbb181a43058a3 -r7612d0b14bca5e0686b654dc0ffb96fcc0ff0a2b
--- Core/Common/test/Core.Common.TestUtil.Test/Core.Common.TestUtil.Test.csproj (.../Core.Common.TestUtil.Test.csproj) (revision d6e6eadf4a2521df75b6d371bacbb181a43058a3)
+++ Core/Common/test/Core.Common.TestUtil.Test/Core.Common.TestUtil.Test.csproj (.../Core.Common.TestUtil.Test.csproj) (revision 7612d0b14bca5e0686b654dc0ffb96fcc0ff0a2b)
@@ -46,6 +46,7 @@
+
Index: Core/Common/test/Core.Common.TestUtil.Test/TestHelperTest.cs
===================================================================
diff -u
--- Core/Common/test/Core.Common.TestUtil.Test/TestHelperTest.cs (revision 0)
+++ Core/Common/test/Core.Common.TestUtil.Test/TestHelperTest.cs (revision 7612d0b14bca5e0686b654dc0ffb96fcc0ff0a2b)
@@ -0,0 +1,54 @@
+using System.IO;
+using NUnit.Framework;
+
+namespace Core.Common.TestUtil.Test
+{
+ [TestFixture]
+ public class TestHelperTest
+ {
+ [Test]
+ public void CanOpenFileForWrite_InvalidPath_DoesNotThrowAnyExceptions()
+ {
+ const string invalidPath = @".\DirectoryDoesNotExist\fileDoesNotExist";
+ var canOpenForWrite = true;
+
+ // Call
+ TestDelegate call = () => canOpenForWrite = TestHelper.CanOpenFileForWrite(invalidPath);
+
+ // Assert
+ Assert.DoesNotThrow(call);
+ Assert.IsFalse(canOpenForWrite);
+ }
+
+ [Test]
+ [TestCase(null)]
+ [TestCase("")]
+ [TestCase(" ")]
+ public void CanOpenFileForWrite_InvalidPath_ThrowsException(string invalidPath)
+ {
+ // Call
+ TestDelegate call = () => TestHelper.CanOpenFileForWrite(invalidPath);
+
+ // Assert
+ Assert.Catch(call);
+ }
+
+ [Test]
+ public void CanOpenFileForWrite_ValidPath_DoesNotThrowAnyExceptions()
+ {
+ const string validPath = @".\fileDoesNotExist";
+ var canOpenForWrite = false;
+
+ // Call
+ TestDelegate call = () => canOpenForWrite = TestHelper.CanOpenFileForWrite(validPath);
+
+ // Assert
+ Assert.DoesNotThrow(call);
+ Assert.IsTrue(canOpenForWrite);
+
+ // Cleanup
+ Assert.IsTrue(File.Exists(validPath));
+ File.Delete(validPath);
+ }
+ }
+}
\ No newline at end of file
Index: Core/Common/test/Core.Common.TestUtil/TestHelper.cs
===================================================================
diff -u -r9c29a906e8ee9c993982d4dc4a3bf2e148af40a0 -r7612d0b14bca5e0686b654dc0ffb96fcc0ff0a2b
--- Core/Common/test/Core.Common.TestUtil/TestHelper.cs (.../TestHelper.cs) (revision 9c29a906e8ee9c993982d4dc4a3bf2e148af40a0)
+++ Core/Common/test/Core.Common.TestUtil/TestHelper.cs (.../TestHelper.cs) (revision 7612d0b14bca5e0686b654dc0ffb96fcc0ff0a2b)
@@ -15,7 +15,7 @@
namespace Core.Common.TestUtil
{
- public class TestHelper
+ public static class TestHelper
{
private static string solutionRoot;
@@ -125,6 +125,33 @@
}
///
+ /// Checks whether the file pointed at by can be opened
+ /// for writing.
+ ///
+ /// The location of the file to open for writing.
+ /// true if the file could be opened with write permissions. false otherwise.
+ public static bool CanOpenFileForWrite(string pathToFile)
+ {
+ FileStream file = null;
+ try
+ {
+ file = File.OpenWrite(pathToFile);
+ return true;
+ }
+ catch (IOException)
+ {
+ return false;
+ }
+ finally
+ {
+ if (file != null)
+ {
+ file.Close();
+ }
+ }
+ }
+
+ ///
///
///
///
@@ -359,7 +386,7 @@
}, StringSplitOptions.None).ToList();
customMessageParts.RemoveAt(customMessageParts.Count - 1);
- message = string.Join(Environment.NewLine, customMessageParts.ToArray());
+ message = String.Join(Environment.NewLine, customMessageParts.ToArray());
}
Assert.AreEqual(expectedCustomMessage, message);
}
@@ -478,6 +505,5 @@
return imageBytes;
}
}
-
}
}
\ No newline at end of file
Index: Core/Common/test/Core.Common.Utils.Test/Core.Common.Utils.Test.csproj
===================================================================
diff -u -r9c29a906e8ee9c993982d4dc4a3bf2e148af40a0 -r7612d0b14bca5e0686b654dc0ffb96fcc0ff0a2b
--- Core/Common/test/Core.Common.Utils.Test/Core.Common.Utils.Test.csproj (.../Core.Common.Utils.Test.csproj) (revision 9c29a906e8ee9c993982d4dc4a3bf2e148af40a0)
+++ Core/Common/test/Core.Common.Utils.Test/Core.Common.Utils.Test.csproj (.../Core.Common.Utils.Test.csproj) (revision 7612d0b14bca5e0686b654dc0ffb96fcc0ff0a2b)
@@ -117,10 +117,12 @@
{F49BD8B2-332A-4C91-A196-8CCE0A2C7D98}
Core.Common.Utils
+ True
{D749EE4C-CE50-4C17-BF01-9A953028C126}
Core.Common.TestUtil
+ True
Index: Core/Plugins/test/Core.Plugins.Charting.Test/Commands/ChartViewCommandBaseTest.cs
===================================================================
diff -u -rf0c2a16f1d03185660d0ac6fbb5fce8bb5c2ee43 -r7612d0b14bca5e0686b654dc0ffb96fcc0ff0a2b
--- Core/Plugins/test/Core.Plugins.Charting.Test/Commands/ChartViewCommandBaseTest.cs (.../ChartViewCommandBaseTest.cs) (revision f0c2a16f1d03185660d0ac6fbb5fce8bb5c2ee43)
+++ Core/Plugins/test/Core.Plugins.Charting.Test/Commands/ChartViewCommandBaseTest.cs (.../ChartViewCommandBaseTest.cs) (revision 7612d0b14bca5e0686b654dc0ffb96fcc0ff0a2b)
@@ -2,8 +2,8 @@
using System.Drawing;
using Core.Common.Controls.Charting;
using Core.Common.Gui;
-using Core.Common.Test.TestObjects;
using Core.Plugins.Charting.Commands;
+using Core.Plugins.CommonTools.Gui.Test.TestObjects;
using NUnit.Framework;
using Rhino.Mocks;
Index: Core/Plugins/test/Core.Plugins.Charting.Test/Commands/DecreaseFontSizeCommandTest.cs
===================================================================
diff -u -rf0c2a16f1d03185660d0ac6fbb5fce8bb5c2ee43 -r7612d0b14bca5e0686b654dc0ffb96fcc0ff0a2b
--- Core/Plugins/test/Core.Plugins.Charting.Test/Commands/DecreaseFontSizeCommandTest.cs (.../DecreaseFontSizeCommandTest.cs) (revision f0c2a16f1d03185660d0ac6fbb5fce8bb5c2ee43)
+++ Core/Plugins/test/Core.Plugins.Charting.Test/Commands/DecreaseFontSizeCommandTest.cs (.../DecreaseFontSizeCommandTest.cs) (revision 7612d0b14bca5e0686b654dc0ffb96fcc0ff0a2b)
@@ -1,7 +1,7 @@
using System.Drawing;
using Core.Common.Controls.Charting;
using Core.Common.Gui;
-using Core.Common.Test.TestObjects;
+using Core.Plugins.CommonTools.Gui.Test.TestObjects;
using Core.Plugins.Charting.Commands;
using NUnit.Framework;
using Rhino.Mocks;
Index: Core/Plugins/test/Core.Plugins.Charting.Test/Commands/ExportChartAsImageCommandTest.cs
===================================================================
diff -u -rf0c2a16f1d03185660d0ac6fbb5fce8bb5c2ee43 -r7612d0b14bca5e0686b654dc0ffb96fcc0ff0a2b
--- Core/Plugins/test/Core.Plugins.Charting.Test/Commands/ExportChartAsImageCommandTest.cs (.../ExportChartAsImageCommandTest.cs) (revision f0c2a16f1d03185660d0ac6fbb5fce8bb5c2ee43)
+++ Core/Plugins/test/Core.Plugins.Charting.Test/Commands/ExportChartAsImageCommandTest.cs (.../ExportChartAsImageCommandTest.cs) (revision 7612d0b14bca5e0686b654dc0ffb96fcc0ff0a2b)
@@ -1,6 +1,6 @@
using Core.Common.Controls.Charting;
using Core.Common.Gui;
-using Core.Common.Test.TestObjects;
+using Core.Plugins.CommonTools.Gui.Test.TestObjects;
using Core.Plugins.Charting.Commands;
using NUnit.Framework;
using Rhino.Mocks;
Index: Core/Plugins/test/Core.Plugins.Charting.Test/Commands/IncreaseFontSizeCommandTest.cs
===================================================================
diff -u -rf0c2a16f1d03185660d0ac6fbb5fce8bb5c2ee43 -r7612d0b14bca5e0686b654dc0ffb96fcc0ff0a2b
--- Core/Plugins/test/Core.Plugins.Charting.Test/Commands/IncreaseFontSizeCommandTest.cs (.../IncreaseFontSizeCommandTest.cs) (revision f0c2a16f1d03185660d0ac6fbb5fce8bb5c2ee43)
+++ Core/Plugins/test/Core.Plugins.Charting.Test/Commands/IncreaseFontSizeCommandTest.cs (.../IncreaseFontSizeCommandTest.cs) (revision 7612d0b14bca5e0686b654dc0ffb96fcc0ff0a2b)
@@ -1,7 +1,7 @@
using System.Drawing;
using Core.Common.Controls.Charting;
using Core.Common.Gui;
-using Core.Common.Test.TestObjects;
+using Core.Plugins.CommonTools.Gui.Test.TestObjects;
using Core.Plugins.Charting.Commands;
using NUnit.Framework;
using Rhino.Mocks;
Index: Core/Plugins/test/Core.Plugins.Charting.Test/Core.Plugins.Charting.Test.csproj
===================================================================
diff -u -rf0c2a16f1d03185660d0ac6fbb5fce8bb5c2ee43 -r7612d0b14bca5e0686b654dc0ffb96fcc0ff0a2b
--- Core/Plugins/test/Core.Plugins.Charting.Test/Core.Plugins.Charting.Test.csproj (.../Core.Plugins.Charting.Test.csproj) (revision f0c2a16f1d03185660d0ac6fbb5fce8bb5c2ee43)
+++ Core/Plugins/test/Core.Plugins.Charting.Test/Core.Plugins.Charting.Test.csproj (.../Core.Plugins.Charting.Test.csproj) (revision 7612d0b14bca5e0686b654dc0ffb96fcc0ff0a2b)
@@ -111,10 +111,6 @@
{D749EE4C-CE50-4C17-BF01-9A953028C126}
Core.Common.TestUtil
-
- {E0990383-FB2E-47D1-99CD-9B9FA2929E5B}
- Core.Common.Test
-
{16050ED1-3E4F-4540-9B5D-6ADD4FC43D9D}
Core.Plugins.Charting
Index: Core/Plugins/test/Core.Plugins.CommonTools.Gui.Test/Core.Plugins.CommonTools.Gui.Test.csproj
===================================================================
diff -u -r82f08332e2704e67c55e21de3eb4bd8fdab9b16c -r7612d0b14bca5e0686b654dc0ffb96fcc0ff0a2b
--- Core/Plugins/test/Core.Plugins.CommonTools.Gui.Test/Core.Plugins.CommonTools.Gui.Test.csproj (.../Core.Plugins.CommonTools.Gui.Test.csproj) (revision 82f08332e2704e67c55e21de3eb4bd8fdab9b16c)
+++ Core/Plugins/test/Core.Plugins.CommonTools.Gui.Test/Core.Plugins.CommonTools.Gui.Test.csproj (.../Core.Plugins.CommonTools.Gui.Test.csproj) (revision 7612d0b14bca5e0686b654dc0ffb96fcc0ff0a2b)
@@ -67,6 +67,7 @@
3.5
+
@@ -75,6 +76,12 @@
+
+
+
+ UserControl
+
+
@@ -125,8 +132,11 @@
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/PipingSurfaceLinesCsvReaderTest.cs
===================================================================
diff -u -rd6e6eadf4a2521df75b6d371bacbb181a43058a3 -r7612d0b14bca5e0686b654dc0ffb96fcc0ff0a2b
--- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/PipingSurfaceLinesCsvReaderTest.cs (.../PipingSurfaceLinesCsvReaderTest.cs) (revision d6e6eadf4a2521df75b6d371bacbb181a43058a3)
+++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/PipingSurfaceLinesCsvReaderTest.cs (.../PipingSurfaceLinesCsvReaderTest.cs) (revision 7612d0b14bca5e0686b654dc0ffb96fcc0ff0a2b)
@@ -6,7 +6,6 @@
using Ringtoets.Piping.IO.Builders;
using Ringtoets.Piping.IO.Exceptions;
-using Ringtoets.Piping.IO.Test.TestHelpers;
using IOResources = Ringtoets.Piping.IO.Properties.Resources;
@@ -605,7 +604,7 @@
}
// Assert
- Assert.IsTrue(FileHelper.CanOpenFileForWrite(path));
+ Assert.IsTrue(TestHelper.CanOpenFileForWrite(path));
}
private void DoReadLine_OpenedValidFileWithHeaderAndTwoSurfaceLines_ReturnCreatedSurfaceLine()
Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Ringtoets.Piping.IO.Test.csproj
===================================================================
diff -u -rd6e6eadf4a2521df75b6d371bacbb181a43058a3 -r7612d0b14bca5e0686b654dc0ffb96fcc0ff0a2b
--- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Ringtoets.Piping.IO.Test.csproj (.../Ringtoets.Piping.IO.Test.csproj) (revision d6e6eadf4a2521df75b6d371bacbb181a43058a3)
+++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/Ringtoets.Piping.IO.Test.csproj (.../Ringtoets.Piping.IO.Test.csproj) (revision 7612d0b14bca5e0686b654dc0ffb96fcc0ff0a2b)
@@ -75,7 +75,6 @@
-
Index: Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/PipingSoilProfileReaderTest.cs
===================================================================
diff -u -rd6e6eadf4a2521df75b6d371bacbb181a43058a3 -r7612d0b14bca5e0686b654dc0ffb96fcc0ff0a2b
--- Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/PipingSoilProfileReaderTest.cs (.../PipingSoilProfileReaderTest.cs) (revision d6e6eadf4a2521df75b6d371bacbb181a43058a3)
+++ Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/SoilProfile/PipingSoilProfileReaderTest.cs (.../PipingSoilProfileReaderTest.cs) (revision 7612d0b14bca5e0686b654dc0ffb96fcc0ff0a2b)
@@ -57,7 +57,7 @@
var dbFile = Path.Combine(testDataPath, dbName);
// Precondition
- Assert.IsTrue(FileHelper.CanOpenFileForWrite(dbFile), "Precondition: file can be opened for edits.");
+ Assert.IsTrue(TestHelper.CanOpenFileForWrite(dbFile), "Precondition: file can be opened for edits.");
// Call
TestDelegate test = () => new PipingSoilProfileReader(dbFile).Dispose();
@@ -66,7 +66,7 @@
var exception = Assert.Throws(test);
var expectedMessage = new FileReaderErrorMessageBuilder(dbFile).Build(String.Format(Resources.Error_SoilProfile_read_from_database, dbName));
Assert.AreEqual(expectedMessage, exception.Message);
- Assert.IsTrue(FileHelper.CanOpenFileForWrite(dbFile));
+ Assert.IsTrue(TestHelper.CanOpenFileForWrite(dbFile));
}
[Test]
@@ -109,15 +109,15 @@
var dbFile = Path.Combine(testDataPath, dbName);
// Precondition
- Assert.IsTrue(FileHelper.CanOpenFileForWrite(dbFile), "Precondition: file can be opened for edits.");
+ Assert.IsTrue(TestHelper.CanOpenFileForWrite(dbFile), "Precondition: file can be opened for edits.");
// Call
TestDelegate test = () => new PipingSoilProfileReader(dbFile).Dispose();
// Assert
var exception = Assert.Throws(test);
Assert.AreEqual(String.Format(Resources.PipingSoilProfileReader_Database_incorrect_version_requires_Version_0_, version), exception.Message);
- Assert.IsTrue(FileHelper.CanOpenFileForWrite(dbFile));
+ Assert.IsTrue(TestHelper.CanOpenFileForWrite(dbFile));
}
[Test]
@@ -187,7 +187,7 @@
Assert.AreEqual("Profile2", pipingSoilProfile.Name);
Assert.AreEqual(3, pipingSoilProfile.Layers.Count());
- Assert.IsTrue(FileHelper.CanOpenFileForWrite(testFile));
+ Assert.IsTrue(TestHelper.CanOpenFileForWrite(testFile));
}
}
@@ -216,7 +216,7 @@
Assert.AreEqual("Profile2", pipingSoilProfile.Name);
Assert.AreEqual(3, pipingSoilProfile.Layers.Count());
- Assert.IsTrue(FileHelper.CanOpenFileForWrite(testFile));
+ Assert.IsTrue(TestHelper.CanOpenFileForWrite(testFile));
}
}
@@ -347,13 +347,13 @@
var dbFile = Path.Combine(testDataPath, testFile);
// Precondition
- Assert.IsTrue(FileHelper.CanOpenFileForWrite(dbFile), "Precondition failed: The file should be writable to begin with.");
+ Assert.IsTrue(TestHelper.CanOpenFileForWrite(dbFile), "Precondition failed: The file should be writable to begin with.");
// Call
new PipingSoilProfileReader(dbFile).Dispose();
// Assert
- Assert.IsTrue(FileHelper.CanOpenFileForWrite(dbFile));
+ Assert.IsTrue(TestHelper.CanOpenFileForWrite(dbFile));
}
[Test]
@@ -364,7 +364,7 @@
var dbFile = Path.Combine(testDataPath, testFile);
// Precondition
- Assert.IsTrue(FileHelper.CanOpenFileForWrite(dbFile), "Precondition failed: The file should be writable to begin with.");
+ Assert.IsTrue(TestHelper.CanOpenFileForWrite(dbFile), "Precondition failed: The file should be writable to begin with.");
PipingSoilProfileReader pipingSoilProfilesReader = null;
PipingSoilProfile profile;
@@ -384,7 +384,7 @@
// Assert
Assert.NotNull(profile);
- Assert.IsTrue(FileHelper.CanOpenFileForWrite(dbFile));
+ Assert.IsTrue(TestHelper.CanOpenFileForWrite(dbFile));
}
[Test]
Fisheye: Tag 7612d0b14bca5e0686b654dc0ffb96fcc0ff0a2b refers to a dead (removed) revision in file `Ringtoets/Piping/test/Ringtoets.Piping.IO.Test/TestHelpers/FileHelper.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSurfaceLineCsvImporterTest.cs
===================================================================
diff -u -rd6e6eadf4a2521df75b6d371bacbb181a43058a3 -r7612d0b14bca5e0686b654dc0ffb96fcc0ff0a2b
--- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSurfaceLineCsvImporterTest.cs (.../PipingSurfaceLineCsvImporterTest.cs) (revision d6e6eadf4a2521df75b6d371bacbb181a43058a3)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSurfaceLineCsvImporterTest.cs (.../PipingSurfaceLineCsvImporterTest.cs) (revision 7612d0b14bca5e0686b654dc0ffb96fcc0ff0a2b)
@@ -11,7 +11,6 @@
using Ringtoets.Piping.Data;
using Ringtoets.Piping.IO.Builders;
-using Ringtoets.Piping.IO.Test.TestHelpers;
using Ringtoets.Piping.Plugin.FileImporter;
using PipingFormsResources = Ringtoets.Piping.Forms.Properties.Resources;
@@ -107,7 +106,7 @@
Assert.AreEqual(4, callCount);
- Assert.IsTrue(FileHelper.CanOpenFileForWrite(validFilePath));
+ Assert.IsTrue(TestHelper.CanOpenFileForWrite(validFilePath));
mocks.VerifyAll();
}
@@ -155,7 +154,7 @@
Assert.AreEqual(427776.654093, firstSurfaceLine.StartingWorldPoint.Y);
CollectionAssert.AllItemsAreUnique(geometryPoints);
- Assert.IsTrue(FileHelper.CanOpenFileForWrite(validFilePath));
+ Assert.IsTrue(TestHelper.CanOpenFileForWrite(validFilePath));
mocks.VerifyAll();
}
@@ -491,7 +490,7 @@
var importTargetArray = observableSurfaceLinesList.ToArray();
Assert.AreEqual(0, importTargetArray.Length);
- Assert.IsTrue(FileHelper.CanOpenFileForWrite(path));
+ Assert.IsTrue(TestHelper.CanOpenFileForWrite(path));
mocks.VerifyAll();
}
Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/Ringtoets.Piping.Plugin.Test.csproj
===================================================================
diff -u -r148b5639633795054317d492507c072ee0bd5ada -r7612d0b14bca5e0686b654dc0ffb96fcc0ff0a2b
--- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/Ringtoets.Piping.Plugin.Test.csproj (.../Ringtoets.Piping.Plugin.Test.csproj) (revision 148b5639633795054317d492507c072ee0bd5ada)
+++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/Ringtoets.Piping.Plugin.Test.csproj (.../Ringtoets.Piping.Plugin.Test.csproj) (revision 7612d0b14bca5e0686b654dc0ffb96fcc0ff0a2b)
@@ -112,10 +112,6 @@
{1d3d58b6-ef7e-401e-92a0-104067d222ee}
Ringtoets.Piping.Plugin
-
- {E4B0E068-F1A3-47BA-965F-0EC1E78E530A}
- Ringtoets.Piping.IO.Test
-