Index: Core/Common/src/Core.Common.Base/Plugin/ApplicationCore.cs
===================================================================
diff -u -rcf4f947febf6a8d92379094230ca4bade46a87d0 -r81982c798fc50dab94c8f1eb8799c04242515564
--- Core/Common/src/Core.Common.Base/Plugin/ApplicationCore.cs (.../ApplicationCore.cs) (revision cf4f947febf6a8d92379094230ca4bade46a87d0)
+++ Core/Common/src/Core.Common.Base/Plugin/ApplicationCore.cs (.../ApplicationCore.cs) (revision 81982c798fc50dab94c8f1eb8799c04242515564)
@@ -23,7 +23,7 @@
}
///
- /// This method adds to the .
+ /// This method adds an to the .
/// Additionally, the provided is activated.
///
/// The to add and activate.
@@ -35,7 +35,7 @@
}
///
- /// This method removes from the .
+ /// This method removes an from the .
/// Additionally, the provided is deactivated.
///
/// The to remove and deactivate.
Index: Core/Common/src/Core.Common.Base/Service/Activity.cs
===================================================================
diff -u -r3fe1e0bdfa0ff0939bbabbc78386ecc7617c96c4 -r81982c798fc50dab94c8f1eb8799c04242515564
--- Core/Common/src/Core.Common.Base/Service/Activity.cs (.../Activity.cs) (revision 3fe1e0bdfa0ff0939bbabbc78386ecc7617c96c4)
+++ Core/Common/src/Core.Common.Base/Service/Activity.cs (.../Activity.cs) (revision 81982c798fc50dab94c8f1eb8799c04242515564)
@@ -125,22 +125,25 @@
///
/// The should be set to when one or more errors occur.
/// By convention, the implementation of this method should not contain UI thread related logic.
+ /// Implementations of this method are allowed to throw exceptions of any kind.
///
protected abstract void OnRun();
///
/// This template method provides the actual cancel logic (it is called within ).
///
///
- /// By convention, the implementation of this method should not contain UI thread related logic.
+ /// By convention, the implementation of this method should not contain UI thread related logic.
+ /// Implementations of this method are allowed to throw exceptions of any kind.
///
protected abstract void OnCancel();
///
/// This template method provides the actual finish logic (it is called within ).
///
///
- /// By convention, only the implementation of this method might contain UI thread related logic.
+ /// By convention, only the implementation of this method might contain UI thread related logic.
+ /// Implementations of this method are allowed to throw exceptions of any kind.
///
protected abstract void OnFinish();
Index: Core/Common/src/Core.Common.Base/Service/FileImportActivity.cs
===================================================================
diff -u -r91c20b58501ea14e3dff6e83d1790e6ba6fea3ff -r81982c798fc50dab94c8f1eb8799c04242515564
--- Core/Common/src/Core.Common.Base/Service/FileImportActivity.cs (.../FileImportActivity.cs) (revision 91c20b58501ea14e3dff6e83d1790e6ba6fea3ff)
+++ Core/Common/src/Core.Common.Base/Service/FileImportActivity.cs (.../FileImportActivity.cs) (revision 81982c798fc50dab94c8f1eb8799c04242515564)
@@ -50,9 +50,17 @@
}
}
+ ///
+ /// This method performs the actual import logic.
+ ///
+ ///
+ /// This method can throw exceptions of any kind.
+ ///
protected override void OnRun()
{
- ImportFromFile(filePath);
+ fileImporter.ProgressChanged = (currentStepName, currentStep, totalSteps) => { ProgressText = string.Format(Resources.FileImportActivity_ImportFromFile_Step_CurrentProgress_0_of_TotalProgress_1_ProgressText_2, currentStep, totalSteps, currentStepName); };
+
+ fileImporter.Import(target, filePath);
}
protected override void OnCancel()
@@ -61,12 +69,5 @@
}
protected override void OnFinish() {}
-
- private void ImportFromFile(string fileName)
- {
- fileImporter.ProgressChanged = (currentStepName, currentStep, totalSteps) => { ProgressText = string.Format(Resources.FileImportActivity_ImportFromFile_Step_CurrentProgress_0_of_TotalProgress_1_ProgressText_2, currentStep, totalSteps, currentStepName); };
-
- fileImporter.Import(target, fileName);
- }
}
}
\ No newline at end of file
Index: Core/Common/test/Core.Common.Base.Test/Plugin/ApplicationCoreTest.cs
===================================================================
diff -u -r3fe1e0bdfa0ff0939bbabbc78386ecc7617c96c4 -r81982c798fc50dab94c8f1eb8799c04242515564
--- Core/Common/test/Core.Common.Base.Test/Plugin/ApplicationCoreTest.cs (.../ApplicationCoreTest.cs) (revision 3fe1e0bdfa0ff0939bbabbc78386ecc7617c96c4)
+++ Core/Common/test/Core.Common.Base.Test/Plugin/ApplicationCoreTest.cs (.../ApplicationCoreTest.cs) (revision 81982c798fc50dab94c8f1eb8799c04242515564)
@@ -46,7 +46,7 @@
var targetItem = new object();
var fileImporter = mocks.Stub();
- fileImporter.Expect(i => i.SupportedItemType).Return(typeof(object)).Repeat.Any();
+ fileImporter.Stub(i => i.SupportedItemType).Return(typeof(object));
mocks.ReplayAll();
@@ -93,7 +93,7 @@
var targetItem = new object();
var fileImporter = mocks.Stub();
- fileImporter.Expect(i => i.SupportedItemType).Return(typeof(object)).Repeat.Any();
+ fileImporter.Stub(i => i.SupportedItemType).Return(typeof(object));
mocks.ReplayAll();
@@ -128,9 +128,9 @@
var supportedFileImporter2 = mocks.Stub();
var unsupportedFileImporter = mocks.Stub();
- supportedFileImporter1.Expect(i => i.SupportedItemType).Return(typeof(B)).Repeat.Any();
- supportedFileImporter2.Expect(i => i.SupportedItemType).Return(typeof(A)).Repeat.Any();
- unsupportedFileImporter.Expect(i => i.SupportedItemType).Return(typeof(C)).Repeat.Any(); // Wrong type
+ supportedFileImporter1.Stub(i => i.SupportedItemType).Return(typeof(B));
+ supportedFileImporter2.Stub(i => i.SupportedItemType).Return(typeof(A));
+ unsupportedFileImporter.Stub(i => i.SupportedItemType).Return(typeof(C)); // Wrong type
mocks.ReplayAll();
@@ -163,7 +163,7 @@
var mocks = new MockRepository();
var fileImporter = mocks.Stub();
- fileImporter.Expect(i => i.SupportedItemType).Return(null).Repeat.Any();
+ fileImporter.Stub(i => i.SupportedItemType).Return(null);
mocks.ReplayAll();
@@ -192,9 +192,9 @@
var supportedFileExporter2 = mocks.Stub();
var unsupportedFileExporter = mocks.Stub();
- supportedFileExporter1.Expect(i => i.SupportedItemType).Return(typeof(B)).Repeat.Any();
- supportedFileExporter2.Expect(i => i.SupportedItemType).Return(typeof(A)).Repeat.Any();
- unsupportedFileExporter.Expect(i => i.SupportedItemType).Return(typeof(C)).Repeat.Any(); // Wrong type
+ supportedFileExporter1.Stub(i => i.SupportedItemType).Return(typeof(B));
+ supportedFileExporter2.Stub(i => i.SupportedItemType).Return(typeof(A));
+ unsupportedFileExporter.Stub(i => i.SupportedItemType).Return(typeof(C)); // Wrong type
mocks.ReplayAll();
@@ -227,7 +227,7 @@
var mocks = new MockRepository();
var fileExporter = mocks.Stub();
- fileExporter.Expect(e => e.SupportedItemType).Return(null).Repeat.Any();
+ fileExporter.Stub(e => e.SupportedItemType).Return(null);
mocks.ReplayAll();
Index: Core/Common/test/Core.Common.Base.Test/Service/FileImportActivityTest.cs
===================================================================
diff -u -r91c20b58501ea14e3dff6e83d1790e6ba6fea3ff -r81982c798fc50dab94c8f1eb8799c04242515564
--- Core/Common/test/Core.Common.Base.Test/Service/FileImportActivityTest.cs (.../FileImportActivityTest.cs) (revision 91c20b58501ea14e3dff6e83d1790e6ba6fea3ff)
+++ Core/Common/test/Core.Common.Base.Test/Service/FileImportActivityTest.cs (.../FileImportActivityTest.cs) (revision 81982c798fc50dab94c8f1eb8799c04242515564)
@@ -11,15 +11,19 @@
public class FileImportActivityTest
{
[Test]
- [ExpectedException(typeof(ArgumentNullException), ExpectedMessage = "Value cannot be null.\r\nParameter name: fileImporter")]
public void Constructor_ImporterEqualsNull_ArgumentExceptionIsThrown()
{
- // Setup / Call / Assert
- new FileImportActivity(null, new object(), "");
+ // Setup
+ TestDelegate test = () => new FileImportActivity(null, new object(), "");
+
+ // Call
+ var message = Assert.Throws(test).Message;
+
+ // Assert
+ StringAssert.EndsWith("fileImporter", message);
}
[Test]
- [ExpectedException(typeof(ArgumentNullException), ExpectedMessage = "Value cannot be null.\r\nParameter name: target")]
public void Constructor_TargetEqualsNull_ArgumentExceptionIsThrown()
{
// Setup
@@ -28,12 +32,16 @@
mocks.ReplayAll();
- // Call / Assert
- new FileImportActivity(fileImporter, null, "");
+ TestDelegate test = () => new FileImportActivity(fileImporter, null, "");
+
+ // Call
+ var message = Assert.Throws(test).Message;
+
+ // Assert
+ StringAssert.EndsWith("target", message);
}
[Test]
- [ExpectedException(typeof(ArgumentNullException), ExpectedMessage = "Value cannot be null.\r\nParameter name: filePath")]
public void Constructor_FilePathEqualsNull_ArgumentExceptionIsThrown()
{
// Setup
@@ -42,8 +50,13 @@
mocks.ReplayAll();
- // Call / Assert
- new FileImportActivity(fileImporter, new object(), null);
+ TestDelegate test = () => new FileImportActivity(fileImporter, new object(), null);
+
+ // Call
+ var message = Assert.Throws(test).Message;
+
+ // Assert
+ StringAssert.EndsWith("filePath", message);
}
[Test]
@@ -53,7 +66,7 @@
var mocks = new MockRepository();
var fileImporter = mocks.Stub();
- fileImporter.Expect(i => i.Name).Return("Importer name").Repeat.Any();
+ fileImporter.Stub(i => i.Name).Return("Importer name");
mocks.ReplayAll();
@@ -72,7 +85,7 @@
var fileImporter = mocks.Stub();
var target = new object();
- fileImporter.Expect(x => x.ProgressChanged = null).IgnoreArguments().Repeat.Any();
+ fileImporter.Stub(x => x.ProgressChanged = null).IgnoreArguments();
fileImporter.Expect(i => i.Import(target, "file")).Return(true);
mocks.ReplayAll();
@@ -94,8 +107,8 @@
var fileImporter = mocks.Stub();
var target = new object();
- fileImporter.Expect(x => x.ProgressChanged = null).IgnoreArguments().Repeat.Any();
- fileImporter.Expect(x => x.Cancel()).IgnoreArguments().Repeat.Any();
+ fileImporter.Stub(x => x.ProgressChanged = null).IgnoreArguments();
+ fileImporter.Expect(x => x.Cancel());
mocks.ReplayAll();