Index: Core/Common/src/Core.Common.Base/ApplicationCore.cs =================================================================== diff -u -rc621c8ee0e3f645a82baedf1654f4d58d1632348 -rd992a9538644381321f71d536c9ea85813d4c443 --- Core/Common/src/Core.Common.Base/ApplicationCore.cs (.../ApplicationCore.cs) (revision c621c8ee0e3f645a82baedf1654f4d58d1632348) +++ Core/Common/src/Core.Common.Base/ApplicationCore.cs (.../ApplicationCore.cs) (revision d992a9538644381321f71d536c9ea85813d4c443) @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using Core.Common.Base.Workflow; +using Core.Common.Utils.Reflection; namespace Core.Common.Base { @@ -21,14 +22,6 @@ } } - internal IEnumerable Plugins - { - get - { - return plugins; - } - } - public IActivityRunner ActivityRunner { get @@ -53,7 +46,7 @@ public virtual void Dispose() { - foreach (var plugin in Plugins.ToList()) + foreach (var plugin in plugins.ToList()) { RemovePlugin(plugin); } @@ -63,5 +56,44 @@ RunningActivityLogAppender.Instance.ActivityRunner = null; } } + + public IEnumerable GetSupportedFileImporters(object target) + { + if (target == null) + { + return Enumerable.Empty(); + } + + var targetType = target.GetType(); + + return plugins.SelectMany(plugin => plugin.GetFileImporters()) + .Where(fileImporter => fileImporter.SupportedItemTypes.Any(t => t == targetType || targetType.Implements(t)) + && fileImporter.CanImportOn(target)); + } + + public IEnumerable GetSupportedFileExporters(object source) + { + if (source == null) + { + return Enumerable.Empty(); + } + + var sourceType = source.GetType(); + + return plugins.SelectMany(plugin => plugin.GetFileExporters()) + .Where(fileExporter => fileExporter.SourceTypes().Any(t => t == sourceType || sourceType.Implements(t)) + && fileExporter.CanExportFor(source)); + } + + public IEnumerable GetSupportedDataItemInfos(object target) + { + if (target == null) + { + return Enumerable.Empty(); + } + + return plugins.SelectMany(p => p.GetDataItemInfos()) + .Where(dataItemInfo => dataItemInfo.AdditionalOwnerCheck == null || dataItemInfo.AdditionalOwnerCheck(target)); + } } } \ No newline at end of file Fisheye: Tag d992a9538644381321f71d536c9ea85813d4c443 refers to a dead (removed) revision in file `Core/Common/src/Core.Common.Base/ApplicationCoreExtensions.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Common/src/Core.Common.Base/Core.Common.Base.csproj =================================================================== diff -u -rf8109189a1cf9b9905556f12faf82c1035c283a4 -rd992a9538644381321f71d536c9ea85813d4c443 --- Core/Common/src/Core.Common.Base/Core.Common.Base.csproj (.../Core.Common.Base.csproj) (revision f8109189a1cf9b9905556f12faf82c1035c283a4) +++ Core/Common/src/Core.Common.Base/Core.Common.Base.csproj (.../Core.Common.Base.csproj) (revision d992a9538644381321f71d536c9ea85813d4c443) @@ -93,7 +93,6 @@ Properties\GlobalAssembly.cs - Index: Core/Common/src/Core.Common.Base/IFileImporter.cs =================================================================== diff -u -ra0af742d946a15bead91b315b77086154f1ed15e -rd992a9538644381321f71d536c9ea85813d4c443 --- Core/Common/src/Core.Common.Base/IFileImporter.cs (.../IFileImporter.cs) (revision a0af742d946a15bead91b315b77086154f1ed15e) +++ Core/Common/src/Core.Common.Base/IFileImporter.cs (.../IFileImporter.cs) (revision d992a9538644381321f71d536c9ea85813d4c443) @@ -32,16 +32,6 @@ IEnumerable SupportedItemTypes { get; } /// - /// Indicates whether or not the importer can import at root level (folder/project). If true, the - /// importer will always show up in the project->import list. If false this importer can only be - /// retrieved by supported type, eg, in code. Use false for partial/composite importers and importers - /// called from map tools etc. If true for TargetFileImporter, the importer is assumed to support - /// both *new* and *into* modes. - /// - /// HACK: REMOVE IT, KEEP DESIGN SIMPLE! - bool CanImportOnRootLevel { get; } - - /// /// The file filter of the importer /// /// "My file format1 (*.ext1)|*.ext1|My file format2 (*.ext2)|*.ext2" Index: Core/Common/src/Core.Common.Gui/ContextMenuItemFactory.cs =================================================================== diff -u -r3d0bcb2ef15e3e8e171f75e0a8cfa20a0a2bbd5e -rd992a9538644381321f71d536c9ea85813d4c443 --- Core/Common/src/Core.Common.Gui/ContextMenuItemFactory.cs (.../ContextMenuItemFactory.cs) (revision 3d0bcb2ef15e3e8e171f75e0a8cfa20a0a2bbd5e) +++ Core/Common/src/Core.Common.Gui/ContextMenuItemFactory.cs (.../ContextMenuItemFactory.cs) (revision d992a9538644381321f71d536c9ea85813d4c443) @@ -16,7 +16,7 @@ public ToolStripItem CreateExportItem(object item) { - var exporters = gui.ApplicationCore.GetSupportedExportersForItem(item); + var exporters = gui.ApplicationCore.GetSupportedFileExporters(item); var newItem = new ToolStripMenuItem(Resources.Export) { ToolTipText = Resources.Export_ToolTip, @@ -30,7 +30,7 @@ public ToolStripItem CreateImportItem(object item) { - var importers = gui.ApplicationCore.GetImporters(item); + var importers = gui.ApplicationCore.GetSupportedFileImporters(item); var newItem = new ToolStripMenuItem(Resources.Import) { ToolTipText = Resources.Import_ToolTip, Index: Core/Common/src/Core.Common.Gui/GuiCommandHandler.cs =================================================================== diff -u -rc621c8ee0e3f645a82baedf1654f4d58d1632348 -rd992a9538644381321f71d536c9ea85813d4c443 --- Core/Common/src/Core.Common.Gui/GuiCommandHandler.cs (.../GuiCommandHandler.cs) (revision c621c8ee0e3f645a82baedf1654f4d58d1632348) +++ Core/Common/src/Core.Common.Gui/GuiCommandHandler.cs (.../GuiCommandHandler.cs) (revision d992a9538644381321f71d536c9ea85813d4c443) @@ -130,7 +130,7 @@ public bool CanImportToGuiSelection() { - return gui.ApplicationCore.GetImporters(gui.Selection).Any(); + return gui.ApplicationCore.GetSupportedFileImporters(gui.Selection).Any(); } public void ImportOn(object target, IFileImporter importer = null) @@ -302,7 +302,7 @@ private GuiExportHandler CreateGuiExportHandler() { - return new GuiExportHandler(o => gui.ApplicationCore.GetSupportedExportersForItem(o), o => gui.DocumentViewsResolver.CreateViewForData(o)); + return new GuiExportHandler(o => gui.ApplicationCore.GetSupportedFileExporters(o), o => gui.DocumentViewsResolver.CreateViewForData(o)); } private void ApplicationProjectClosing(Project project) Index: Core/Common/src/Core.Common.Gui/GuiImportHandler.cs =================================================================== diff -u -rf8109189a1cf9b9905556f12faf82c1035c283a4 -rd992a9538644381321f71d536c9ea85813d4c443 --- Core/Common/src/Core.Common.Gui/GuiImportHandler.cs (.../GuiImportHandler.cs) (revision f8109189a1cf9b9905556f12faf82c1035c283a4) +++ Core/Common/src/Core.Common.Gui/GuiImportHandler.cs (.../GuiImportHandler.cs) (revision d992a9538644381321f71d536c9ea85813d4c443) @@ -45,19 +45,19 @@ { var selectImporterDialog = new SelectItemDialog(); - IList importers = gui.ApplicationCore.GetImporters(target); + var importers = gui.ApplicationCore.GetSupportedFileImporters(target); //if there is only one available exporter use that. - if (importers.Count == 0) + if (!importers.Any()) { MessageBox.Show(Resources.GuiImportHandler_GetSupportedImporterForTargetType_No_importer_available_for_this_item); Log.ErrorFormat(Resources.GuiImportHandler_GetSupportedImporterForTargetType_No_importer_available_for_this_item_0_, target); return null; } //if there is only one available importer use that. - if (importers.Count == 1) + if (importers.Count() == 1) { - return importers[0]; + return importers.ElementAt(0); } foreach (IFileImporter importer in importers) @@ -89,20 +89,20 @@ Image itemImage = Resources.brick; - IList importers = gui.ApplicationCore.GetImporters(target); + var importers = gui.ApplicationCore.GetSupportedFileImporters(target); importers = importers.Where( importer => FileUtils.FileMatchesFileFilterByExtension(importer.FileFilter, files.First())).ToList(); //if there is only one available importer use that.)) - if (importers.Count == 0) + if (!importers.Any()) { return null; } - if (importers.Count == 1) + if (importers.Count() == 1) { - return importers[0]; + return importers.ElementAt(0); } foreach (IFileImporter importer in importers) Index: Core/Common/test/Core.Common.Integration.Tests/Ringtoets/Application.Ringtoets/GuiImportHandlerTest.cs =================================================================== diff -u -rf8109189a1cf9b9905556f12faf82c1035c283a4 -rd992a9538644381321f71d536c9ea85813d4c443 --- Core/Common/test/Core.Common.Integration.Tests/Ringtoets/Application.Ringtoets/GuiImportHandlerTest.cs (.../GuiImportHandlerTest.cs) (revision f8109189a1cf9b9905556f12faf82c1035c283a4) +++ Core/Common/test/Core.Common.Integration.Tests/Ringtoets/Application.Ringtoets/GuiImportHandlerTest.cs (.../GuiImportHandlerTest.cs) (revision d992a9538644381321f71d536c9ea85813d4c443) @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; using System.Windows.Forms; using Core.Common.Base; using Core.Common.Controls.Swf; @@ -104,177 +102,5 @@ mocks.VerifyAll(); } - - [Test] - public void NonRootLevelImportersAreNotReturnedForNullType() - { - var plugin = mocks.Stub(); - var fileImporter = mocks.Stub(); - var targetItemImporter = mocks.Stub(); - var targetItemImporter2 = mocks.Stub(); - - plugin.Expect(p => p.Activate()).Repeat.Once(); - plugin.Expect(p => p.GetFileImporters()).Return(new[] - { - fileImporter, - targetItemImporter, - targetItemImporter2 - }); - - fileImporter.Expect(fi => fi.CanImportOnRootLevel).Return(false); - targetItemImporter.Expect(fi => fi.CanImportOnRootLevel).Return(false); - targetItemImporter2.Expect(fi => fi.CanImportOnRootLevel).Return(true); - - mocks.ReplayAll(); - - var applicationCore = new ApplicationCore(); - - applicationCore.AddPlugin(plugin); - - gui.ApplicationCore = applicationCore; - - var fileImporters = applicationCore.GetImporters(null); - - Assert.AreEqual(1, fileImporters.Count); - Assert.AreSame(targetItemImporter2, fileImporters.First()); - - mocks.VerifyAll(); - } - - [Test] - public void TargetItemFileImporterAreReturnedWhenMatch() - { - var plugin = mocks.Stub(); - var fileImporter = mocks.Stub(); - var targetItemImporter = mocks.Stub(); - var targetItemImporterWhereCanImportIsFalse = mocks.Stub(); - - plugin.Expect(p => p.Activate()).Repeat.Once(); - plugin.Expect(p => p.GetFileImporters()).Return(new[] - { - fileImporter, - targetItemImporter, - targetItemImporterWhereCanImportIsFalse - }); - - fileImporter.Expect(fi => fi.SupportedItemTypes).Return(new[] - { - typeof(Int64) - }); - fileImporter.Expect(fi => fi.CanImportOn(null)).IgnoreArguments().Return(true).Repeat.Any(); - - targetItemImporter.Expect(fi => fi.SupportedItemTypes).Return(new[] - { - typeof(Int64) - }); - targetItemImporter.Expect(fi => fi.CanImportOn(null)).IgnoreArguments().Return(true).Repeat.Any(); - - targetItemImporterWhereCanImportIsFalse.Expect(fi => fi.SupportedItemTypes).Return(new[] - { - typeof(Int64) - }); - targetItemImporterWhereCanImportIsFalse.Expect(fi => fi.CanImportOn(null)).IgnoreArguments().Return(false).Repeat.Any(); - - mocks.ReplayAll(); - - var applicationCore = new ApplicationCore(); - - applicationCore.AddPlugin(plugin); - - gui.ApplicationCore = applicationCore; - - var fileImporters = applicationCore.GetImporters((long)1.0); - - Assert.AreEqual(2, fileImporters.Count); - - mocks.VerifyAll(); - } - - [Test] - public void TargetItemFileImporterCanMatchOnSubtype() // Note: Test verifies that an importer for type A matches on type B if B implements A - { - var plugin = mocks.Stub(); - var targetItemImporter = mocks.Stub(); - - plugin.Expect(p => p.Activate()).Repeat.Once(); - plugin.Expect(p => p.GetFileImporters()).Return(new[] - { - targetItemImporter - }); - - targetItemImporter.Expect(fi => fi.SupportedItemTypes).Return(new[] - { - typeof(IList) - }); - targetItemImporter.Expect(fi => fi.CanImportOn(null)).IgnoreArguments().Return(true).Repeat.Any(); - - mocks.ReplayAll(); - - var applicationCore = new ApplicationCore(); - - applicationCore.AddPlugin(plugin); - - gui.ApplicationCore = applicationCore; - - //get importers for subtype - var fileImporters = applicationCore.GetImporters(new List()); - - Assert.AreEqual(new[] - { - targetItemImporter - }, fileImporters); - - mocks.VerifyAll(); - } - - [Test] - public void AllPluginsAreSearchedForFileImportersAndOnlyMatchingImportersAreReturned() - { - var plugin = mocks.Stub(); - var fileImporter1 = mocks.Stub(); - var fileImporter2 = mocks.Stub(); - var fileImporter3 = mocks.Stub(); - - plugin.Expect(p => p.Activate()).Repeat.Once(); - plugin.Expect(p => p.GetFileImporters()).Return(new[] - { - fileImporter1, - fileImporter2, - fileImporter3 - }); - - fileImporter1.Expect(fi => fi.SupportedItemTypes).Return(new[] - { - typeof(Int32) - }); - - fileImporter2.Expect(fi => fi.SupportedItemTypes).Return(new[] - { - typeof(Int64) - }); - - fileImporter3.Expect(fi => fi.SupportedItemTypes).Return(new[] - { - typeof(Int16) - }); - - fileImporter1.Expect(fi => fi.CanImportOn(null)).IgnoreArguments().Return(true).Repeat.Any(); - fileImporter2.Expect(fi => fi.CanImportOn(null)).IgnoreArguments().Return(true).Repeat.Any(); - fileImporter3.Expect(fi => fi.CanImportOn(null)).IgnoreArguments().Return(true).Repeat.Any(); - - mocks.ReplayAll(); - - var applicationCore = new ApplicationCore(); - - applicationCore.AddPlugin(plugin); - - gui.ApplicationCore = applicationCore; - - var fileImporters = applicationCore.GetImporters((long) 1.0); - - Assert.AreEqual(1, fileImporters.Count); - - mocks.VerifyAll(); - } } } \ No newline at end of file Index: Core/Common/test/Core.Common.Tests/Core/ApplicationCoreTest.cs =================================================================== diff -u -r7b4f672be7e2d4eb74d7b7f7a88538b3f586d57c -rd992a9538644381321f71d536c9ea85813d4c443 --- Core/Common/test/Core.Common.Tests/Core/ApplicationCoreTest.cs (.../ApplicationCoreTest.cs) (revision 7b4f672be7e2d4eb74d7b7f7a88538b3f586d57c) +++ Core/Common/test/Core.Common.Tests/Core/ApplicationCoreTest.cs (.../ApplicationCoreTest.cs) (revision d992a9538644381321f71d536c9ea85813d4c443) @@ -1,4 +1,6 @@ +using System; using System.Collections.Generic; +using System.Linq; using Core.Common.Base; using NUnit.Framework; using Rhino.Mocks; @@ -32,5 +34,130 @@ mocks.VerifyAll(); } } + + [Test] + public void TargetItemFileImporterAreReturnedWhenMatch() + { + var mocks = new MockRepository(); + var plugin = mocks.Stub(); + var fileImporter = mocks.Stub(); + var fileImporterWhereCanImportIsFalse = mocks.Stub(); + + plugin.Expect(p => p.Activate()).Repeat.Once(); + plugin.Expect(p => p.GetFileImporters()).Return(new[] + { + fileImporter, + fileImporterWhereCanImportIsFalse + }); + + fileImporter.Expect(fi => fi.SupportedItemTypes).Return(new[] + { + typeof(Int64) + }); + fileImporter.Expect(fi => fi.CanImportOn(null)).IgnoreArguments().Return(true).Repeat.Any(); + + fileImporterWhereCanImportIsFalse.Expect(fi => fi.SupportedItemTypes).Return(new[] + { + typeof(Int64) + }); + fileImporterWhereCanImportIsFalse.Expect(fi => fi.CanImportOn(null)).IgnoreArguments().Return(false).Repeat.Any(); + + mocks.ReplayAll(); + + var applicationCore = new ApplicationCore(); + + applicationCore.AddPlugin(plugin); + + var fileImporters = applicationCore.GetSupportedFileImporters((long) 1.0).ToList(); + + Assert.AreEqual(1, fileImporters.Count); + Assert.AreSame(fileImporter, fileImporters[0]); + + mocks.VerifyAll(); + } + + [Test] + public void TargetItemFileImporterCanMatchOnSubtype() // Note: Test verifies that an importer for type A matches on type B if B implements A + { + var mocks = new MockRepository(); + var plugin = mocks.Stub(); + var fileImporter = mocks.Stub(); + + plugin.Expect(p => p.Activate()).Repeat.Once(); + plugin.Expect(p => p.GetFileImporters()).Return(new[] + { + fileImporter + }); + + fileImporter.Expect(fi => fi.SupportedItemTypes).Return(new[] + { + typeof(IList) + }); + fileImporter.Expect(fi => fi.CanImportOn(null)).IgnoreArguments().Return(true).Repeat.Any(); + + mocks.ReplayAll(); + + var applicationCore = new ApplicationCore(); + + applicationCore.AddPlugin(plugin); + + // Get importers for subtype + var fileImporters = applicationCore.GetSupportedFileImporters(new List()).ToList(); + + Assert.AreEqual(1, fileImporters.Count); + Assert.AreSame(fileImporter, fileImporters[0]); + + mocks.VerifyAll(); + } + + [Test] + public void AllPluginsAreSearchedForFileImportersAndOnlyMatchingImportersAreReturned() + { + var mocks = new MockRepository(); + var plugin = mocks.Stub(); + var fileImporter1 = mocks.Stub(); + var fileImporter2 = mocks.Stub(); + var fileImporter3 = mocks.Stub(); + + plugin.Expect(p => p.Activate()).Repeat.Once(); + plugin.Expect(p => p.GetFileImporters()).Return(new[] + { + fileImporter1, + fileImporter2, + fileImporter3 + }); + + fileImporter1.Expect(fi => fi.SupportedItemTypes).Return(new[] + { + typeof(Int32) + }); + + fileImporter2.Expect(fi => fi.SupportedItemTypes).Return(new[] + { + typeof(Int64) + }); + + fileImporter3.Expect(fi => fi.SupportedItemTypes).Return(new[] + { + typeof(Int16) + }); + + fileImporter1.Expect(fi => fi.CanImportOn(null)).IgnoreArguments().Return(true).Repeat.Any(); + fileImporter2.Expect(fi => fi.CanImportOn(null)).IgnoreArguments().Return(true).Repeat.Any(); + fileImporter3.Expect(fi => fi.CanImportOn(null)).IgnoreArguments().Return(true).Repeat.Any(); + + mocks.ReplayAll(); + + var applicationCore = new ApplicationCore(); + + applicationCore.AddPlugin(plugin); + + var fileImporters = applicationCore.GetSupportedFileImporters((long) 1.0).ToList(); + + Assert.AreEqual(1, fileImporters.Count); + Assert.AreSame(fileImporter2, fileImporters[0]); + + mocks.VerifyAll(); + } } } \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingSoilProfilesImporter.cs =================================================================== diff -u -ra0af742d946a15bead91b315b77086154f1ed15e -rd992a9538644381321f71d536c9ea85813d4c443 --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingSoilProfilesImporter.cs (.../PipingSoilProfilesImporter.cs) (revision a0af742d946a15bead91b315b77086154f1ed15e) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingSoilProfilesImporter.cs (.../PipingSoilProfilesImporter.cs) (revision d992a9538644381321f71d536c9ea85813d4c443) @@ -55,14 +55,6 @@ } } - public bool CanImportOnRootLevel - { - get - { - return false; - } - } - public string FileFilter { get Index: Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingSurfaceLinesCsvImporter.cs =================================================================== diff -u -ra0af742d946a15bead91b315b77086154f1ed15e -rd992a9538644381321f71d536c9ea85813d4c443 --- Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingSurfaceLinesCsvImporter.cs (.../PipingSurfaceLinesCsvImporter.cs) (revision a0af742d946a15bead91b315b77086154f1ed15e) +++ Ringtoets/Piping/src/Ringtoets.Piping.Plugin/FileImporter/PipingSurfaceLinesCsvImporter.cs (.../PipingSurfaceLinesCsvImporter.cs) (revision d992a9538644381321f71d536c9ea85813d4c443) @@ -67,14 +67,6 @@ } } - public bool CanImportOnRootLevel - { - get - { - return false; - } - } - public string FileFilter { get Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSoilProfilesImporterTest.cs =================================================================== diff -u -ra0af742d946a15bead91b315b77086154f1ed15e -rd992a9538644381321f71d536c9ea85813d4c443 --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSoilProfilesImporterTest.cs (.../PipingSoilProfilesImporterTest.cs) (revision a0af742d946a15bead91b315b77086154f1ed15e) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSoilProfilesImporterTest.cs (.../PipingSoilProfilesImporterTest.cs) (revision d992a9538644381321f71d536c9ea85813d4c443) @@ -47,7 +47,6 @@ Assert.AreEqual(16, importer.Image.Width); Assert.AreEqual(16, importer.Image.Height); CollectionAssert.AreEqual(new[] { typeof(ICollection) }, importer.SupportedItemTypes); - Assert.IsFalse(importer.CanImportOnRootLevel); Assert.AreEqual(expectedFileFilter, importer.FileFilter); Assert.IsFalse(importer.ShouldCancel); Assert.IsNull(importer.ProgressChanged); Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSurfaceLineCsvImporterTest.cs =================================================================== diff -u -ra0af742d946a15bead91b315b77086154f1ed15e -rd992a9538644381321f71d536c9ea85813d4c443 --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSurfaceLineCsvImporterTest.cs (.../PipingSurfaceLineCsvImporterTest.cs) (revision a0af742d946a15bead91b315b77086154f1ed15e) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/PipingSurfaceLineCsvImporterTest.cs (.../PipingSurfaceLineCsvImporterTest.cs) (revision d992a9538644381321f71d536c9ea85813d4c443) @@ -38,7 +38,6 @@ Assert.AreEqual(16, importer.Image.Width); Assert.AreEqual(16, importer.Image.Height); CollectionAssert.AreEqual(new[] { typeof(ICollection) }, importer.SupportedItemTypes); - Assert.IsFalse(importer.CanImportOnRootLevel); var expectedFileFilter = String.Format("{0} {1} (*.csv)|*.csv", PipingFormsResources.PipingSurfaceLinesCollection_DisplayName, ApplicationResources.Csv_file_name); Assert.AreEqual(expectedFileFilter, importer.FileFilter);