Index: Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs =================================================================== diff -u -rba649bf26cd557bf4788a8b4fa19cf848b36fd87 -rdee00ab2cf59f8d4ed966e25b429b7f131d5ccdf --- Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision ba649bf26cd557bf4788a8b4fa19cf848b36fd87) +++ Ringtoets/Integration/src/Ringtoets.Integration.Plugin/RingtoetsPlugin.cs (.../RingtoetsPlugin.cs) (revision dee00ab2cf59f8d4ed966e25b429b7f131d5ccdf) @@ -1,4 +1,4 @@ -// Copyright (C) Stichting Deltares 2017. All rights reserved. +// Copyright (C) Stichting Deltares 2017. All rights reserved. // // This file is part of Ringtoets. // @@ -691,6 +691,15 @@ FileFilterGenerator = new FileFilterGenerator(RingtoetsCommonIOResources.Shape_file_filter_Extension, RingtoetsCommonIOResources.Shape_file_filter_Description) }; + + yield return new ExportInfo + { + Name = RingtoetsFormsResources.AssemblyResults_DisplayName, + CreateFileExporter = (context, filePath) => new AssemblyExporter(context.WrappedData, filePath), + IsEnabled = context => true, + FileFilterGenerator = new FileFilterGenerator("gml", + "gml file") + }; } public override IEnumerable GetUpdateInfos() Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ExportInfos/AssemblyResultsContextExportInfoTest.cs =================================================================== diff -u --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ExportInfos/AssemblyResultsContextExportInfoTest.cs (revision 0) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/ExportInfos/AssemblyResultsContextExportInfoTest.cs (revision dee00ab2cf59f8d4ed966e25b429b7f131d5ccdf) @@ -0,0 +1,118 @@ +// Copyright (C) Stichting Deltares 2017. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Linq; +using Core.Common.Base.IO; +using Core.Common.Gui.Plugin; +using Core.Common.TestUtil; +using Core.Common.Util; +using NUnit.Framework; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Integration.Data; +using Ringtoets.Integration.Forms.PresentationObjects; +using Ringtoets.Integration.IO.Exporters; +using CoreCommonGuiResources = Core.Common.Gui.Properties.Resources; + +namespace Ringtoets.Integration.Plugin.Test.ExportInfos +{ + [TestFixture] + public class AssemblyResultsContextExportInfoTest + { + [Test] + public void Initialized_Always_ExpectedPropertiesSet() + { + // Setup + using (var plugin = new RingtoetsPlugin()) + { + // Call + ExportInfo info = GetExportInfo(plugin); + + // Assert + Assert.IsNotNull(info.CreateFileExporter); + Assert.IsNotNull(info.IsEnabled); + Assert.AreEqual("Assemblage", info.Name); + Assert.AreEqual("Algemeen", info.Category); + TestHelper.AssertImagesAreEqual(CoreCommonGuiResources.ExportIcon, info.Image); + Assert.IsNotNull(info.FileFilterGenerator); + } + } + + [Test] + public void CreateFileExporter_Always_ReturnFileExporter() + { + // Setup + var random = new Random(21); + var assessmentSection = new AssessmentSection(random.NextEnumValue()); + var context = new AssemblyResultsContext(assessmentSection); + + const string filePath = "test"; + + using (var plugin = new RingtoetsPlugin()) + { + ExportInfo info = GetExportInfo(plugin); + + // Call + IFileExporter fileExporter = info.CreateFileExporter(context, filePath); + + // Assert + Assert.IsInstanceOf(fileExporter); + } + } + + [Test] + public void FileFilterGenerator_Always_ReturnFileFilter() + { + // Setup + using (var plugin = new RingtoetsPlugin()) + { + ExportInfo info = GetExportInfo(plugin); + + // Call + FileFilterGenerator fileFilterGenerator = info.FileFilterGenerator; + + // Assert + Assert.AreEqual("gml file (*.gml)|*.gml", fileFilterGenerator.Filter); + } + } + + [Test] + public void IsEnabled_Always_ReturnsTrue() + { + // Setup + using (var plugin = new RingtoetsPlugin()) + { + ExportInfo info = GetExportInfo(plugin); + + // Call + bool isEnabled = info.IsEnabled(null); + + // Assert + Assert.IsTrue(isEnabled); + } + } + + private static ExportInfo GetExportInfo(RingtoetsPlugin plugin) + { + return plugin.GetExportInfos().First(ei => ei.DataType == typeof(AssemblyResultsContext)); + } + } +} \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj =================================================================== diff -u -rba649bf26cd557bf4788a8b4fa19cf848b36fd87 -rdee00ab2cf59f8d4ed966e25b429b7f131d5ccdf --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision ba649bf26cd557bf4788a8b4fa19cf848b36fd87) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/Ringtoets.Integration.Plugin.Test.csproj (.../Ringtoets.Integration.Plugin.Test.csproj) (revision dee00ab2cf59f8d4ed966e25b429b7f131d5ccdf) @@ -1,4 +1,4 @@ - + {15E7B9D9-A177-42AE-8BC7-91B6DFBAB0EC} @@ -48,6 +48,7 @@ + Index: Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs =================================================================== diff -u -rba649bf26cd557bf4788a8b4fa19cf848b36fd87 -rdee00ab2cf59f8d4ed966e25b429b7f131d5ccdf --- Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision ba649bf26cd557bf4788a8b4fa19cf848b36fd87) +++ Ringtoets/Integration/test/Ringtoets.Integration.Plugin.Test/RingtoetsPluginTest.cs (.../RingtoetsPluginTest.cs) (revision dee00ab2cf59f8d4ed966e25b429b7f131d5ccdf) @@ -366,9 +366,10 @@ ExportInfo[] exportInfos = plugin.GetExportInfos().ToArray(); // Assert - Assert.AreEqual(2, exportInfos.Length); + Assert.AreEqual(3, exportInfos.Length); Assert.IsTrue(exportInfos.Any(ei => ei.DataType == typeof(ReferenceLineContext))); Assert.IsTrue(exportInfos.Any(ei => ei.DataType == typeof(HydraulicBoundaryDatabaseContext))); + Assert.IsTrue(exportInfos.Any(ei => ei.DataType == typeof(AssemblyResultsContext))); } }