Index: Core/Common/src/Core.Common.Base/Plugin/ApplicationCore.cs =================================================================== diff -u -rd1e069321cba9d3b92f873fdd18e393a20659542 -r2d209fab7140dfcd277106ee15a1896234159930 --- Core/Common/src/Core.Common.Base/Plugin/ApplicationCore.cs (.../ApplicationCore.cs) (revision d1e069321cba9d3b92f873fdd18e393a20659542) +++ Core/Common/src/Core.Common.Base/Plugin/ApplicationCore.cs (.../ApplicationCore.cs) (revision 2d209fab7140dfcd277106ee15a1896234159930) @@ -84,19 +84,19 @@ } /// - /// This method returns a collection of that support the . + /// This method returns a collection of that are supported for . /// - /// The target to get the collection of supported for. + /// The owner to get the collection of supported for. /// The collection of supported . - public IEnumerable GetSupportedDataItemInfos(object target) + public IEnumerable GetSupportedDataItemInfos(object owner) { - if (target == null) + if (owner == null) { return Enumerable.Empty(); } return plugins.SelectMany(p => p.GetDataItemInfos()) - .Where(dataItemInfo => dataItemInfo.AdditionalOwnerCheck == null || dataItemInfo.AdditionalOwnerCheck(target)); + .Where(dataItemInfo => dataItemInfo.AdditionalOwnerCheck == null || dataItemInfo.AdditionalOwnerCheck(owner)); } public virtual void Dispose() Index: Core/Common/src/Core.Common.Base/Service/FileImportActivity.cs =================================================================== diff -u -re823dc6f52bf6a01f421c69b95a07e6258ec33de -r2d209fab7140dfcd277106ee15a1896234159930 --- Core/Common/src/Core.Common.Base/Service/FileImportActivity.cs (.../FileImportActivity.cs) (revision e823dc6f52bf6a01f421c69b95a07e6258ec33de) +++ Core/Common/src/Core.Common.Base/Service/FileImportActivity.cs (.../FileImportActivity.cs) (revision 2d209fab7140dfcd277106ee15a1896234159930) @@ -59,12 +59,12 @@ { foreach (var fileName in filePaths) { - ImportFromFile(fileName); - if (shouldCancel) { break; } + + ImportFromFile(fileName); } shouldCancel = false; Index: Core/Common/test/Core.Common.Base.Test/Core.Common.Base.Test.csproj =================================================================== diff -u -rbf306ed5e8bab6bbe0bd42bbcaf4e7ed64738aa5 -r2d209fab7140dfcd277106ee15a1896234159930 --- Core/Common/test/Core.Common.Base.Test/Core.Common.Base.Test.csproj (.../Core.Common.Base.Test.csproj) (revision bf306ed5e8bab6bbe0bd42bbcaf4e7ed64738aa5) +++ Core/Common/test/Core.Common.Base.Test/Core.Common.Base.Test.csproj (.../Core.Common.Base.Test.csproj) (revision 2d209fab7140dfcd277106ee15a1896234159930) @@ -77,6 +77,7 @@ + Index: Core/Common/test/Core.Common.Base.Test/Data/ProjectTest.cs =================================================================== diff -u -r6016a9db20f1833086b35bc6aedcb2b0a3efe19d -r2d209fab7140dfcd277106ee15a1896234159930 --- Core/Common/test/Core.Common.Base.Test/Data/ProjectTest.cs (.../ProjectTest.cs) (revision 6016a9db20f1833086b35bc6aedcb2b0a3efe19d) +++ Core/Common/test/Core.Common.Base.Test/Data/ProjectTest.cs (.../ProjectTest.cs) (revision 2d209fab7140dfcd277106ee15a1896234159930) @@ -10,12 +10,11 @@ [Test] public void DefaultConstructor_ExpectedValue() { - // call + // Call var project = new Project(); - // assert + // Assert Assert.IsInstanceOf(project); - Assert.AreEqual("Project", project.Name); Assert.IsNull(project.Description); CollectionAssert.IsEmpty(project.Items); @@ -24,13 +23,14 @@ [Test] public void NameConstructor_SetNameAndInitializeOtherProperties() { - // setup + // Setup const string someName = ""; - // call + // Call var project = new Project(someName); - // assert + // Assert + Assert.IsInstanceOf(project); Assert.AreEqual(someName, project.Name); Assert.IsNull(project.Description); CollectionAssert.IsEmpty(project.Items); @@ -39,44 +39,45 @@ [Test] public void AutomaticProperties_SetAndGettingValue_ShouldReturnSetValue() { - // setup & Call + // Setup const string niceProjectName = "Nice project name"; const string nicerDescription = "Nicer description"; + // Call var project = new Project { Name = niceProjectName, Description = nicerDescription, }; - // assert + // Assert Assert.AreEqual(niceProjectName, project.Name); Assert.AreEqual(nicerDescription, project.Description); } [Test] public void NotifyObservers_WithObserverAttached_ObserverIsNotified() { - // setup + // Setup var mocks = new MockRepository(); var observerMock = mocks.StrictMock(); - observerMock.Expect(o => o.UpdateObserver()); + observerMock.Expect(o => o.UpdateObserver()).Repeat.Once(); mocks.ReplayAll(); var project = new Project(); project.Attach(observerMock); - // call + // Call project.NotifyObservers(); - // assert + // Assert mocks.VerifyAll(); } [Test] public void NotifyObservers_AttachedObserverHasBeenDetached_ObserverShouldNoLongerBeNotified() { - // setup + // Setup var mocks = new MockRepository(); var observerMock = mocks.StrictMock(); observerMock.Expect(o => o.UpdateObserver()).Repeat.Once(); @@ -86,11 +87,11 @@ project.Attach(observerMock); project.NotifyObservers(); - // call + // Call project.Detach(observerMock); project.NotifyObservers(); - // assert + // Assert mocks.VerifyAll(); } } Index: Core/Common/test/Core.Common.Base.Test/ObservableListTest.cs =================================================================== diff -u -r6016a9db20f1833086b35bc6aedcb2b0a3efe19d -r2d209fab7140dfcd277106ee15a1896234159930 --- Core/Common/test/Core.Common.Base.Test/ObservableListTest.cs (.../ObservableListTest.cs) (revision 6016a9db20f1833086b35bc6aedcb2b0a3efe19d) +++ Core/Common/test/Core.Common.Base.Test/ObservableListTest.cs (.../ObservableListTest.cs) (revision 2d209fab7140dfcd277106ee15a1896234159930) @@ -12,11 +12,11 @@ public void DefaultConstructor_ExpectedValues() { // Call - var list = new ObservableList(); + var observableList = new ObservableList(); // Assert - Assert.IsInstanceOf>(list); - Assert.IsInstanceOf(list); + Assert.IsInstanceOf>(observableList); + Assert.IsInstanceOf(observableList); } [Test] @@ -28,11 +28,11 @@ observer.Expect(o => o.UpdateObserver()); // Expect to be called once mocks.ReplayAll(); - var list = new ObservableList(); - list.Attach(observer); + var observableList = new ObservableList(); + observableList.Attach(observer); // Call - list.NotifyObservers(); + observableList.NotifyObservers(); // Assert mocks.VerifyAll(); @@ -46,12 +46,12 @@ var observer = mocks.StrictMock(); mocks.ReplayAll(); - var list = new ObservableList(); - list.Attach(observer); - list.Detach(observer); + var observableList = new ObservableList(); + observableList.Attach(observer); + observableList.Detach(observer); // Call - list.NotifyObservers(); + observableList.NotifyObservers(); // Assert mocks.VerifyAll(); // Expect no calls on 'observer' @@ -62,7 +62,7 @@ { // Setup var mocks = new MockRepository(); - var testObservable = new ObservableList(); + var observableList = new ObservableList(); var observer1 = mocks.Stub(); var observer2 = mocks.Stub(); @@ -71,23 +71,23 @@ var observer5 = mocks.Stub(); var observer6 = mocks.Stub(); - testObservable.Attach(observer1); - testObservable.Attach(observer2); - testObservable.Attach(observer3); - testObservable.Attach(observer4); - testObservable.Attach(observer6); + observableList.Attach(observer1); + observableList.Attach(observer2); + observableList.Attach(observer3); + observableList.Attach(observer4); + observableList.Attach(observer6); observer1.Expect(o => o.UpdateObserver()).Repeat.Once(); - observer2.Expect(o => o.UpdateObserver()).Do((Action)(() => testObservable.Detach(observer3))).Repeat.Once(); + observer2.Expect(o => o.UpdateObserver()).Do((Action)(() => observableList.Detach(observer3))).Repeat.Once(); observer3.Expect(o => o.UpdateObserver()).Repeat.Never(); // A detached observer should no longer be updated - observer4.Expect(o => o.UpdateObserver()).Do((Action)(() => testObservable.Attach(observer5))).Repeat.Once(); + observer4.Expect(o => o.UpdateObserver()).Do((Action)(() => observableList.Attach(observer5))).Repeat.Once(); observer5.Expect(o => o.UpdateObserver()).Repeat.Never(); // An attached observer should not be updated too observer6.Expect(o => o.UpdateObserver()).Repeat.Once(); mocks.ReplayAll(); // Call - testObservable.NotifyObservers(); + observableList.NotifyObservers(); // Assert mocks.VerifyAll(); Index: Core/Common/test/Core.Common.Base.Test/ObservableTest.cs =================================================================== diff -u -r41c77f9f36ae74a406fd382187426cc06d2b0200 -r2d209fab7140dfcd277106ee15a1896234159930 --- Core/Common/test/Core.Common.Base.Test/ObservableTest.cs (.../ObservableTest.cs) (revision 41c77f9f36ae74a406fd382187426cc06d2b0200) +++ Core/Common/test/Core.Common.Base.Test/ObservableTest.cs (.../ObservableTest.cs) (revision 2d209fab7140dfcd277106ee15a1896234159930) @@ -8,6 +8,44 @@ public class ObservableTest { [Test] + public void NotifyObservers_WithObserverAttached_ObserverIsNotified() + { + // Setup + var mocks = new MockRepository(); + var observer = mocks.StrictMock(); + observer.Expect(o => o.UpdateObserver()); // Expect to be called once + mocks.ReplayAll(); + + var observable = new TestObservable(); + observable.Attach(observer); + + // Call + observable.NotifyObservers(); + + // Assert + mocks.VerifyAll(); + } + + [Test] + public void NotifyObserver_AttachedObserverDetachedAgain_ObserverNoLongerNotified() + { + // Setup + var mocks = new MockRepository(); + var observer = mocks.StrictMock(); + mocks.ReplayAll(); + + var observable = new TestObservable(); + observable.Attach(observer); + observable.Detach(observer); + + // Call + observable.NotifyObservers(); + + // Assert + mocks.VerifyAll(); // Expect no calls on 'observer' + } + + [Test] public void NotifyObservers_MultipleObserversDetachingOrAttachingOthers_NoUpdatesForAttachedAndDetachedObservers() { // Setup @@ -45,7 +83,7 @@ private class TestObservable : Observable { - + } } } Index: Core/Common/test/Core.Common.Base.Test/Plugin/ApplicationCoreTest.cs =================================================================== diff -u --- Core/Common/test/Core.Common.Base.Test/Plugin/ApplicationCoreTest.cs (revision 0) +++ Core/Common/test/Core.Common.Base.Test/Plugin/ApplicationCoreTest.cs (revision 2d209fab7140dfcd277106ee15a1896234159930) @@ -0,0 +1,394 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Core.Common.Base.IO; +using Core.Common.Base.Plugin; +using NUnit.Framework; +using Rhino.Mocks; + +namespace Core.Common.Base.Test.Plugin +{ + [TestFixture] + public class ApplicationCoreTest + { + [Test] + public void DefaultConstructor_ExpectedValue() + { + // Call + var applicationCore = new ApplicationCore(); + + // Assert + Assert.IsInstanceOf(applicationCore); + } + + [Test] + public void AddPlugin_ApplicationPlugin_ShouldActivatePlugin() + { + // Setup + var mocks = new MockRepository(); + var applicationCore = new ApplicationCore(); + var applicationPlugin = mocks.Stub(); + applicationPlugin.Expect(ap => ap.Activate()).Repeat.Once(); + mocks.ReplayAll(); + + // Call + applicationCore.AddPlugin(applicationPlugin); + + // Assert + mocks.VerifyAll(); // Asserts that the Activate method is called + } + + [Test] + public void AddPlugin_SimpleApplicationPluginWithImporter_ShouldExposePluginDefinitions() + { + // Setup + var mocks = new MockRepository(); + var targetItem = new object(); + var fileImporter = mocks.Stub(); + + fileImporter.Expect(i => i.SupportedItemType).Return(typeof(object)).Repeat.Any(); + fileImporter.Expect(i => i.CanImportFor(targetItem)).Return(true).Repeat.Any(); + + mocks.ReplayAll(); + + var applicationCore = new ApplicationCore(); + var applicationPlugin = new SimpleApplicationPlugin + { + FileImporters = new[] + { + fileImporter + } + }; + + // Call + applicationCore.AddPlugin(applicationPlugin); + + // Assert + Assert.AreEqual(1, applicationCore.GetSupportedFileImporters(targetItem).Count()); + } + + [Test] + public void RemovePlugin_ApplicationPlugin_ShouldDeactivatePlugin() + { + // Setup + var mocks = new MockRepository(); + var applicationCore = new ApplicationCore(); + var applicationPlugin = mocks.Stub(); + applicationPlugin.Expect(ap => ap.Deactivate()).Repeat.Once(); + mocks.ReplayAll(); + + // Call + applicationCore.RemovePlugin(applicationPlugin); + + // Assert + mocks.VerifyAll(); // Asserts that the Deactivate method is called + } + + [Test] + public void RemovePlugin_SimpleApplicationPluginWithImport_ShouldNoLongerExposePluginDefinitions() + { + // Setup + var mocks = new MockRepository(); + var targetItem = new object(); + var fileImporter = mocks.Stub(); + + fileImporter.Expect(i => i.SupportedItemType).Return(typeof(object)).Repeat.Any(); + fileImporter.Expect(i => i.CanImportFor(targetItem)).Return(true).Repeat.Any(); + + mocks.ReplayAll(); + + var applicationCore = new ApplicationCore(); + var applicationPlugin = new SimpleApplicationPlugin + { + FileImporters = new[] + { + fileImporter + } + }; + + applicationCore.AddPlugin(applicationPlugin); + + // Preconditions + Assert.AreEqual(1, applicationCore.GetSupportedFileImporters(targetItem).Count()); + + // Call + applicationCore.RemovePlugin(applicationPlugin); + + // Assert + Assert.AreEqual(0, applicationCore.GetSupportedFileImporters(targetItem).Count()); + } + + [Test] + public void GetSupportedFileImporters_SimpleApplicationPluginWithImportersAdded_ShouldOnlyProvideSupportedImporters() + { + // Setup + var mocks = new MockRepository(); + var targetItem = new B(); + var supportedFileImporter1 = mocks.Stub(); + var supportedFileImporter2 = mocks.Stub(); + var unsupportedFileImporter1 = mocks.Stub(); + var unsupportedFileImporter2 = mocks.Stub(); + + supportedFileImporter1.Expect(i => i.SupportedItemType).Return(typeof(B)).Repeat.Any(); + supportedFileImporter1.Expect(i => i.CanImportFor(targetItem)).Return(true).Repeat.Any(); + + supportedFileImporter2.Expect(i => i.SupportedItemType).Return(typeof(A)).Repeat.Any(); + supportedFileImporter2.Expect(i => i.CanImportFor(targetItem)).Return(true).Repeat.Any(); + + unsupportedFileImporter1.Expect(i => i.SupportedItemType).Return(typeof(B)).Repeat.Any(); + unsupportedFileImporter1.Expect(i => i.CanImportFor(targetItem)).Return(false).Repeat.Any(); // CanImportFor false + + unsupportedFileImporter2.Expect(i => i.SupportedItemType).Return(typeof(C)).Repeat.Any(); // Wrong type + unsupportedFileImporter2.Expect(i => i.CanImportFor(targetItem)).Return(true).Repeat.Any(); + + mocks.ReplayAll(); + + var applicationCore = new ApplicationCore(); + var applicationPlugin = new SimpleApplicationPlugin + { + FileImporters = new[] + { + supportedFileImporter1, + supportedFileImporter2, + unsupportedFileImporter1, + unsupportedFileImporter2 + } + }; + + applicationCore.AddPlugin(applicationPlugin); + + // Call + var supportedImporters = applicationCore.GetSupportedFileImporters(targetItem).ToList(); + + // Assert + Assert.AreEqual(2, supportedImporters.Count); + Assert.AreSame(supportedFileImporter1, supportedImporters[0]); + Assert.AreSame(supportedFileImporter2, supportedImporters[1]); + } + + [Test] + public void GetSupportedFileImporters_SimpleApplicationPluginWithImportersAdded_ShouldProvideNoImportersWhenTargetEqualsNull() + { + // Setup + var mocks = new MockRepository(); + var fileImporter = mocks.Stub(); + + fileImporter.Expect(i => i.SupportedItemType).Return(null).Repeat.Any(); + fileImporter.Expect(i => i.CanImportFor(null)).Repeat.Any(); + + mocks.ReplayAll(); + + var applicationCore = new ApplicationCore(); + var applicationPlugin = new SimpleApplicationPlugin + { + FileImporters = new[] + { + fileImporter + } + }; + + applicationCore.AddPlugin(applicationPlugin); + + // Call + var supportedImporters = applicationCore.GetSupportedFileImporters(null).ToList(); + + // Assert + Assert.AreEqual(0, supportedImporters.Count); + } + + [Test] + public void GetSupportedFileExporters_SimpleApplicationPluginWithExportersAdded_ShouldOnlyProvideSupportedExporters() + { + // Setup + var mocks = new MockRepository(); + var targetItem = new B(); + var supportedFileExporter1 = mocks.Stub(); + var supportedFileExporter2 = mocks.Stub(); + var unsupportedFileExporter1 = mocks.Stub(); + var unsupportedFileExporter2 = mocks.Stub(); + + supportedFileExporter1.Expect(i => i.SupportedItemType).Return(typeof(B)).Repeat.Any(); + supportedFileExporter1.Expect(i => i.CanExportFor(targetItem)).Return(true).Repeat.Any(); + + supportedFileExporter2.Expect(i => i.SupportedItemType).Return(typeof(A)).Repeat.Any(); + supportedFileExporter2.Expect(i => i.CanExportFor(targetItem)).Return(true).Repeat.Any(); + + unsupportedFileExporter1.Expect(i => i.SupportedItemType).Return(typeof(B)).Repeat.Any(); + unsupportedFileExporter1.Expect(i => i.CanExportFor(targetItem)).Return(false).Repeat.Any(); // CanExportFor false + + unsupportedFileExporter2.Expect(i => i.SupportedItemType).Return(typeof(C)).Repeat.Any(); // Wrong type + unsupportedFileExporter2.Expect(i => i.CanExportFor(targetItem)).Return(true).Repeat.Any(); + + mocks.ReplayAll(); + + var applicationCore = new ApplicationCore(); + var applicationPlugin = new SimpleApplicationPlugin + { + FileExporters = new[] + { + supportedFileExporter1, + supportedFileExporter2, + unsupportedFileExporter1, + unsupportedFileExporter2 + } + }; + + applicationCore.AddPlugin(applicationPlugin); + + // Call + var supportedExporters = applicationCore.GetSupportedFileExporters(targetItem).ToList(); + + // Assert + Assert.AreEqual(2, supportedExporters.Count); + Assert.AreSame(supportedFileExporter1, supportedExporters[0]); + Assert.AreSame(supportedFileExporter2, supportedExporters[1]); + } + + [Test] + public void GetSupportedFileExporters_SimpleApplicationPluginWithExportersAdded_ShouldProvideNoExportersWhenSourceEqualsNull() + { + // Setup + var mocks = new MockRepository(); + var fileExporter = mocks.Stub(); + + fileExporter.Expect(e => e.SupportedItemType).Return(null).Repeat.Any(); + fileExporter.Expect(e => e.CanExportFor(null)).Repeat.Any(); + + mocks.ReplayAll(); + + var applicationCore = new ApplicationCore(); + var applicationPlugin = new SimpleApplicationPlugin + { + FileExporters = new[] + { + fileExporter + } + }; + + applicationCore.AddPlugin(applicationPlugin); + + // Call + var supportedExporters = applicationCore.GetSupportedFileExporters(null).ToList(); + + // Assert + Assert.AreEqual(0, supportedExporters.Count); + } + + [Test] + public void GetSupportedDataItemInfos_SimpleApplicationPluginWithDataItemInfosAdded_ShouldOnlyProvideSupportedDataItemInfos() + { + // Setup + var mocks = new MockRepository(); + var supportedDataItemInfo = new DataItemInfo + { + AdditionalOwnerCheck = o => true + }; + var unsupportedDataItemInfo = new DataItemInfo + { + AdditionalOwnerCheck = o => false // AdditionalOwnerCheck false + }; + + mocks.ReplayAll(); + + var applicationCore = new ApplicationCore(); + var applicationPlugin = new SimpleApplicationPlugin + { + DataItemInfos = new[] + { + supportedDataItemInfo, + unsupportedDataItemInfo, + } + }; + + applicationCore.AddPlugin(applicationPlugin); + + // Call + var supportedDataItemInfos = applicationCore.GetSupportedDataItemInfos(new object()).ToList(); + + // Assert + Assert.AreEqual(1, supportedDataItemInfos.Count); + Assert.AreSame(supportedDataItemInfo, supportedDataItemInfos[0]); + } + + [Test] + public void GetSupportedDataItemInfos_SimpleApplicationPluginWithDataItemInfosAdded_ShouldProvideNoDataItemInfosWhenTargetEqualsNull() + { + // Setup + var dataItemInfo = new DataItemInfo + { + AdditionalOwnerCheck = o => true + }; + + var applicationCore = new ApplicationCore(); + var applicationPlugin = new SimpleApplicationPlugin + { + DataItemInfos = new[] + { + dataItemInfo + } + }; + + applicationCore.AddPlugin(applicationPlugin); + + // Call + var supportedDataItemInfos = applicationCore.GetSupportedDataItemInfos(null).ToList(); + + // Assert + Assert.AreEqual(0, supportedDataItemInfos.Count); + } + + [Test] + public void Dispose_TwoApplicationPluginsAdded_ShouldRemoveAllAddedPlugins() + { + // Setup + var mocks = new MockRepository(); + var applicationCore = new ApplicationCore(); + var applicationPlugin1 = mocks.Stub(); + var applicationPlugin2 = mocks.Stub(); + applicationPlugin1.Expect(ap => ap.Activate()).Repeat.Once(); + applicationPlugin1.Expect(ap => ap.Deactivate()).Repeat.Once(); + applicationPlugin2.Expect(ap => ap.Activate()).Repeat.Once(); + applicationPlugin2.Expect(ap => ap.Deactivate()).Repeat.Once(); + mocks.ReplayAll(); + + applicationCore.AddPlugin(applicationPlugin1); + applicationCore.AddPlugin(applicationPlugin2); + + // Call + applicationCore.Dispose(); + + // Assert + mocks.VerifyAll(); // Asserts that the Deactivate methods are called + } + + private class SimpleApplicationPlugin : ApplicationPlugin + { + public IEnumerable FileImporters { private get; set; } + + public IEnumerable FileExporters { private get; set; } + + public IEnumerable DataItemInfos { private get; set; } + + public override IEnumerable GetFileImporters() + { + return FileImporters; + } + + public override IEnumerable GetFileExporters() + { + return FileExporters; + } + + public override IEnumerable GetDataItemInfos() + { + return DataItemInfos; + } + } + + private class A {} + + private class B : A {} + + private class C : B {} + } +} \ No newline at end of file Index: Core/Common/test/Core.Common.Base.Test/Plugin/ApplicationPluginTest.cs =================================================================== diff -u -r6016a9db20f1833086b35bc6aedcb2b0a3efe19d -r2d209fab7140dfcd277106ee15a1896234159930 --- Core/Common/test/Core.Common.Base.Test/Plugin/ApplicationPluginTest.cs (.../ApplicationPluginTest.cs) (revision 6016a9db20f1833086b35bc6aedcb2b0a3efe19d) +++ Core/Common/test/Core.Common.Base.Test/Plugin/ApplicationPluginTest.cs (.../ApplicationPluginTest.cs) (revision 2d209fab7140dfcd277106ee15a1896234159930) @@ -8,46 +8,47 @@ public class ApplicationPluginTest { [Test] - public void GetFileImporters_ReturnEmptyEnummerable() + public void GetFileImporters_ReturnEmptyEnumerable() { - // setup + // Setup var applicationPlugin = new SimpleApplicationPlugin(); - // call + // Call var importers = applicationPlugin.GetFileImporters().ToArray(); - // assert + // Assert CollectionAssert.IsEmpty(importers); } [Test] - public void GetFileExporters_ReturnEmptyEnummerable() + public void GetFileExporters_ReturnEmptyEnumerable() { - // setup + // Setup var applicationPlugin = new SimpleApplicationPlugin(); - // call + // Call var importers = applicationPlugin.GetFileExporters().ToArray(); - // assert + // Assert CollectionAssert.IsEmpty(importers); } [Test] - public void GetDataItemInfos_ReturnEmptyEnummerable() + public void GetDataItemInfos_ReturnEmptyEnumerable() { - // setup + // Setup var applicationPlugin = new SimpleApplicationPlugin(); - // call + // Call var importers = applicationPlugin.GetDataItemInfos().ToArray(); - // assert + // Assert CollectionAssert.IsEmpty(importers); } - } - internal class SimpleApplicationPlugin : ApplicationPlugin - { + private class SimpleApplicationPlugin : ApplicationPlugin + { + + } } } \ No newline at end of file Index: Core/Common/test/Core.Common.Base.Test/Plugin/DataItemInfoTest.cs =================================================================== diff -u -rd1e069321cba9d3b92f873fdd18e393a20659542 -r2d209fab7140dfcd277106ee15a1896234159930 --- Core/Common/test/Core.Common.Base.Test/Plugin/DataItemInfoTest.cs (.../DataItemInfoTest.cs) (revision d1e069321cba9d3b92f873fdd18e393a20659542) +++ Core/Common/test/Core.Common.Base.Test/Plugin/DataItemInfoTest.cs (.../DataItemInfoTest.cs) (revision 2d209fab7140dfcd277106ee15a1896234159930) @@ -10,38 +10,38 @@ [Test] public void DefaultConstructor_NonGeneric_ExpectedValues() { - // call - var info = new DataItemInfo(); + // Call + var dataItemInfo = new DataItemInfo(); - // assert - Assert.IsNull(info.ValueType); - Assert.IsNull(info.Name); - Assert.IsNull(info.Category); - Assert.IsNull(info.Image); - Assert.IsNull(info.AdditionalOwnerCheck); - Assert.IsNull(info.CreateData); + // Assert + Assert.IsNull(dataItemInfo.ValueType); + Assert.IsNull(dataItemInfo.Name); + Assert.IsNull(dataItemInfo.Category); + Assert.IsNull(dataItemInfo.Image); + Assert.IsNull(dataItemInfo.AdditionalOwnerCheck); + Assert.IsNull(dataItemInfo.CreateData); } [Test] public void DefaultConstructor_Generic_ExpectedValues() { - // call - var info = new DataItemInfo(); + // Call + var dataItemInfo = new DataItemInfo(); - // assert - Assert.AreEqual(typeof(double), info.ValueType); - Assert.IsNull(info.Name); - Assert.IsNull(info.Category); - Assert.IsNull(info.Image); - Assert.IsNull(info.AdditionalOwnerCheck); - Assert.IsNull(info.CreateData); + // Assert + Assert.AreEqual(typeof(double), dataItemInfo.ValueType); + Assert.IsNull(dataItemInfo.Name); + Assert.IsNull(dataItemInfo.Category); + Assert.IsNull(dataItemInfo.Image); + Assert.IsNull(dataItemInfo.AdditionalOwnerCheck); + Assert.IsNull(dataItemInfo.CreateData); } [Test] public void GetSetAutomaticProperties_NonGeneric_ExpectedBehavior() { - // setup & call - var info = new DataItemInfo + // Setup / Call + var dataItemInfo = new DataItemInfo { ValueType = typeof(double), Name = "Some double", @@ -51,20 +51,20 @@ CreateData = o => 1.2, }; - // assert - Assert.AreEqual(typeof(double), info.ValueType); - Assert.AreEqual("Some double", info.Name); - Assert.AreEqual("Nice category", info.Category); - Assert.IsNotNull(info.Image); - Assert.IsTrue(info.AdditionalOwnerCheck(null)); - Assert.AreEqual(1.2, info.CreateData(null)); + // Assert + Assert.AreEqual(typeof(double), dataItemInfo.ValueType); + Assert.AreEqual("Some double", dataItemInfo.Name); + Assert.AreEqual("Nice category", dataItemInfo.Category); + Assert.IsNotNull(dataItemInfo.Image); + Assert.IsTrue(dataItemInfo.AdditionalOwnerCheck(null)); + Assert.AreEqual(1.2, dataItemInfo.CreateData(null)); } [Test] public void GetSetAutomaticProperties_Generic_ExpectedBehavior() { - // setup & call - var info = new DataItemInfo + // Setup / Call + var dataItemInfo = new DataItemInfo { Name = "Some integer", Category = "Better category", @@ -74,18 +74,18 @@ }; // assert - Assert.AreEqual(typeof(int), info.ValueType); - Assert.AreEqual("Some integer", info.Name); - Assert.AreEqual("Better category", info.Category); - Assert.IsNotNull(info.Image); - Assert.IsFalse(info.AdditionalOwnerCheck(null)); - Assert.AreEqual(-1, info.CreateData(null)); + Assert.AreEqual(typeof(int), dataItemInfo.ValueType); + Assert.AreEqual("Some integer", dataItemInfo.Name); + Assert.AreEqual("Better category", dataItemInfo.Category); + Assert.IsNotNull(dataItemInfo.Image); + Assert.IsFalse(dataItemInfo.AdditionalOwnerCheck(null)); + Assert.AreEqual(-1, dataItemInfo.CreateData(null)); } [Test] public void ImplicitConversion_FromGenericToNonGeneric_ShouldCopyValues() { - // setup + // Setup var info = new DataItemInfo { Name = "Some integer", @@ -95,10 +95,10 @@ CreateData = o => -1, }; - // call + // Call var nonGenericInfo = (DataItemInfo) info; - // assert + // Assert Assert.AreEqual(info.ValueType, nonGenericInfo.ValueType); Assert.AreEqual(info.Name, nonGenericInfo.Name); Assert.AreEqual(info.Category, nonGenericInfo.Category); @@ -109,18 +109,18 @@ [Test] public void ImplicitConversion_FromGenericToNonGenericWithoutMethodsSet_MethodsShouldBeNull() { - // setup + // Setup var info = new DataItemInfo { Name = "Some integer", Category = "Better category", Image = new Bitmap(16, 16) }; - // call + // Call var nonGenericInfo = (DataItemInfo) info; - // assert + // Assert Assert.AreEqual(info.ValueType, nonGenericInfo.ValueType); Assert.AreEqual(info.Name, nonGenericInfo.Name); Assert.AreEqual(info.Category, nonGenericInfo.Category);