Fisheye: Tag 2fd96187f75c7b24ccb411ecf5b6c8f0dcc591bb refers to a dead (removed) revision in file `Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ExportInfos/HydraulicBoundariesGroupContextExportInfoTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ExportInfos/HydraulicBoundariesGroupContextLocationsExportInfoTest.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ExportInfos/HydraulicBoundariesGroupContextLocationsExportInfoTest.cs (revision 0) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ExportInfos/HydraulicBoundariesGroupContextLocationsExportInfoTest.cs (revision 2fd96187f75c7b24ccb411ecf5b6c8f0dcc591bb) @@ -0,0 +1,146 @@ +// Copyright (C) Stichting Deltares 2016. 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.Drawing; +using System.Linq; +using Core.Common.Base.IO; +using Core.Common.Gui; +using Core.Common.Gui.Plugin; +using Core.Common.TestUtil; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.Common.Data.Hydraulics; +using Ringtoets.Common.IO.Hydraulics; +using Ringtoets.GrassCoverErosionOutwards.Data; +using Ringtoets.GrassCoverErosionOutwards.Forms.PresentationObjects; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.GrassCoverErosionOutwards.Plugin.Test.ExportInfos +{ + [TestFixture] + public class HydraulicBoundariesGroupContextLocationsExportInfoTest + { + private ExportInfo exportInfo; + + [SetUp] + public void Setup() + { + using (var plugin = new GrassCoverErosionOutwardsPlugin()) + { + exportInfo = plugin.GetExportInfos() + .Single(ei => ei.DataType == typeof(HydraulicBoundariesGroupContext) + && ei.Name.Equals("Waterstanden en golfhoogtes uit marginale statistiek (*.shp).")); + } + } + + [Test] + public void Category_Always_ReturnExpectedCategory() + { + // Call + string category = exportInfo.Category; + + // Assert + Assert.AreEqual("Algemeen", category); + } + + [Test] + public void Image_Always_ReturnExpectedImage() + { + // Call + Image image = exportInfo.Image; + + // Assert + TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.PointShapefileIcon, image); + } + + [Test] + public void CreateFileExporter_Always_ReturnFileExporter() + { + // Setup + var mockRepository = new MockRepository(); + var assessmentSection = mockRepository.Stub(); + mockRepository.ReplayAll(); + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + + var context = new HydraulicBoundariesGroupContext(failureMechanism.HydraulicBoundaryLocations, failureMechanism, assessmentSection); + + // Call + IFileExporter fileExporter = exportInfo.CreateFileExporter(context, "test"); + + // Assert + Assert.IsInstanceOf(fileExporter); + mockRepository.VerifyAll(); + } + + [Test] + public void FileFilterGenerator_Always_ReturnFileFilter() + { + // Call + FileFilterGenerator fileFilterGenerator = exportInfo.FileFilterGenerator; + + // Assert + Assert.AreEqual("Shapebestand (*.shp)|*.shp", fileFilterGenerator.Filter); + } + + [Test] + public void IsEnabled_HydraulicBoundaryLocationsEmpty_ReturnFalse() + { + // Setup + var mockRepository = new MockRepository(); + var assessmentSection = mockRepository.Stub(); + mockRepository.ReplayAll(); + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + + var context = new HydraulicBoundariesGroupContext(failureMechanism.HydraulicBoundaryLocations, failureMechanism, assessmentSection); + + // Call + bool isEnabled = exportInfo.IsEnabled(context); + + // Assert + Assert.IsFalse(isEnabled); + mockRepository.VerifyAll(); + } + + [Test] + public void IsEnabled_HydraulicBoundaryLocationsNotEmpty_ReturnTrue() + { + // Setup + var mockRepository = new MockRepository(); + var assessmentSection = mockRepository.Stub(); + mockRepository.ReplayAll(); + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + failureMechanism.SetGrassCoverErosionOutwardsHydraulicBoundaryLocations(new[] + { + new HydraulicBoundaryLocation(0, "aName", 0, 0) + }); + + var context = new HydraulicBoundariesGroupContext(failureMechanism.HydraulicBoundaryLocations, failureMechanism, assessmentSection); + + // Call + bool isEnabled = exportInfo.IsEnabled(context); + + // Assert + Assert.IsTrue(isEnabled); + mockRepository.VerifyAll(); + } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ExportInfos/HydraulicBoundariesGroupContextWaveConditionsExportInfoTest.cs =================================================================== diff -u --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ExportInfos/HydraulicBoundariesGroupContextWaveConditionsExportInfoTest.cs (revision 0) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/ExportInfos/HydraulicBoundariesGroupContextWaveConditionsExportInfoTest.cs (revision 2fd96187f75c7b24ccb411ecf5b6c8f0dcc591bb) @@ -0,0 +1,166 @@ +// Copyright (C) Stichting Deltares 2016. 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.Drawing; +using System.Linq; +using Core.Common.Base.IO; +using Core.Common.Gui; +using Core.Common.Gui.Plugin; +using Core.Common.TestUtil; +using NUnit.Framework; +using Rhino.Mocks; +using Ringtoets.Common.Data.AssessmentSection; +using Ringtoets.GrassCoverErosionOutwards.Data; +using Ringtoets.GrassCoverErosionOutwards.Forms.PresentationObjects; +using Ringtoets.GrassCoverErosionOutwards.IO.Exporters; +using Ringtoets.Revetment.Data; +using RingtoetsCommonFormsResources = Ringtoets.Common.Forms.Properties.Resources; + +namespace Ringtoets.GrassCoverErosionOutwards.Plugin.Test.ExportInfos +{ + [TestFixture] + public class HydraulicBoundariesGroupContextWaveConditionsExportInfoTest + { + private ExportInfo exportInfo; + + [SetUp] + public void Setup() + { + using (var plugin = new GrassCoverErosionOutwardsPlugin()) + { + exportInfo = plugin.GetExportInfos() + .Single(ei => ei.DataType == typeof(HydraulicBoundariesGroupContext) + && ei.Name.Equals("Berekende belastingen bij verschillende waterstanden (*.csv).")); + } + } + + [Test] + public void Category_Always_ReturnExpectedCategory() + { + // Setup + string category = exportInfo.Category; + + // Assert + Assert.AreEqual("Algemeen", category); + } + + [Test] + public void Image_Always_ReturnExpectedImage() + { + // Call + Image image = exportInfo.Image; + + // Assert + TestHelper.AssertImagesAreEqual(RingtoetsCommonFormsResources.GeneralOutputIcon, image); + } + + [Test] + public void CreateFileExporter_Always_ReturnFileExporter() + { + // Setup + var mockRepository = new MockRepository(); + var assessmentSection = mockRepository.Stub(); + mockRepository.ReplayAll(); + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + + var context = new HydraulicBoundariesGroupContext(failureMechanism.HydraulicBoundaryLocations, failureMechanism, assessmentSection); + + // Call + IFileExporter fileExporter = exportInfo.CreateFileExporter(context, "test"); + + // Assert + Assert.IsInstanceOf(fileExporter); + mockRepository.VerifyAll(); + } + + [Test] + public void FileFilterGenerator_Always_ReturnFileFilter() + { + // Call + FileFilterGenerator fileFilterGenerator = exportInfo.FileFilterGenerator; + + // Assert + Assert.AreEqual("Kommagescheiden bestand (*.csv)|*.csv", fileFilterGenerator.Filter); + } + + [Test] + public void IsEnabled_NoCalculations_ReturnFalse() + { + // Setup + var mockRepository = new MockRepository(); + var assessmentSection = mockRepository.Stub(); + mockRepository.ReplayAll(); + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + + var context = new HydraulicBoundariesGroupContext(failureMechanism.HydraulicBoundaryLocations, failureMechanism, assessmentSection); + + // Call + bool isEnabled = exportInfo.IsEnabled(context); + + // Assert + Assert.IsFalse(isEnabled); + mockRepository.VerifyAll(); + } + + [Test] + public void IsEnabled_CalculationsWithoutOutput_ReturnFalse() + { + // Setup + var mockRepository = new MockRepository(); + var assessmentSection = mockRepository.Stub(); + mockRepository.ReplayAll(); + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + failureMechanism.WaveConditionsCalculationGroup.Children.Add(new GrassCoverErosionOutwardsWaveConditionsCalculation()); + + var context = new HydraulicBoundariesGroupContext(failureMechanism.HydraulicBoundaryLocations, failureMechanism, assessmentSection); + + // Call + bool isEnabled = exportInfo.IsEnabled(context); + + // Assert + Assert.IsFalse(isEnabled); + mockRepository.VerifyAll(); + } + + [Test] + public void IsEnabled_CalculationsWithOutput_ReturnTrue() + { + // Setup + var mockRepository = new MockRepository(); + var assessmentSection = mockRepository.Stub(); + mockRepository.ReplayAll(); + var failureMechanism = new GrassCoverErosionOutwardsFailureMechanism(); + failureMechanism.WaveConditionsCalculationGroup.Children.Add(new GrassCoverErosionOutwardsWaveConditionsCalculation + { + Output = new GrassCoverErosionOutwardsWaveConditionsOutput(Enumerable.Empty()) + }); + + var context = new HydraulicBoundariesGroupContext(failureMechanism.HydraulicBoundaryLocations, failureMechanism, assessmentSection); + + // Call + bool isEnabled = exportInfo.IsEnabled(context); + + // Assert + Assert.IsTrue(isEnabled); + mockRepository.VerifyAll(); + } + } +} \ No newline at end of file Index: Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test.csproj =================================================================== diff -u -r9b74444dd480cd55762fb34129883f90b8616356 -r2fd96187f75c7b24ccb411ecf5b6c8f0dcc591bb --- Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test.csproj (.../Ringtoets.GrassCoverErosionOutwards.Plugin.Test.csproj) (revision 9b74444dd480cd55762fb34129883f90b8616356) +++ Ringtoets/GrassCoverErosionOutwards/test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test/Ringtoets.GrassCoverErosionOutwards.Plugin.Test.csproj (.../Ringtoets.GrassCoverErosionOutwards.Plugin.Test.csproj) (revision 2fd96187f75c7b24ccb411ecf5b6c8f0dcc591bb) @@ -67,7 +67,8 @@ - + +