// 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.IO;
using Core.Common.Base.Service;
using Core.Common.Utils.IO;
using Ringtoets.Common.Data.FailureMechanism;
using Ringtoets.Common.Forms.PresentationObjects;
using Ringtoets.Common.IO;
using Ringtoets.Integration.Data;
using Ringtoets.Integration.Plugin.FileImporters;
namespace Ringtoets.Piping.Integration.Test
{
///
/// Helper methods related to integration tests.
///
public static class IntegrationTestHelper
{
///
/// Imports the reference line on the .
///
/// The to import the reference line on.
public static void ImportReferenceLine(AssessmentSection assessmentSection)
{
using (var embeddedResourceFileWriter = new EmbeddedResourceFileWriter(typeof(IntegrationTestHelper).Assembly,
true,
"traject_6-3.shp",
"traject_6-3.dbf",
"traject_6-3.prj",
"traject_6-3.shx"))
{
var activity = new FileImportActivity(new ReferenceLineImporter(),
new ReferenceLineContext(assessmentSection),
Path.Combine(embeddedResourceFileWriter.TargetFolderPath, "traject_6-3.shp"));
activity.Run();
activity.Finish();
}
}
///
/// Imports the failure mechanism sections.
///
/// The to import on.
/// The to import on.
/// This will import 283 failure mechanism sections.
public static void ImportFailureMechanismSections(AssessmentSection assessmentSection, IFailureMechanism failureMechanism)
{
using (var embeddedResourceFileWriter = new EmbeddedResourceFileWriter(typeof(IntegrationTestHelper).Assembly,
true,
"traject_6-3_vakken.shp",
"traject_6-3_vakken.dbf",
"traject_6-3_vakken.prj",
"traject_6-3_vakken.shx"))
{
var activity = new FileImportActivity(new FailureMechanismSectionsImporter(),
new FailureMechanismSectionsContext(failureMechanism, assessmentSection),
Path.Combine(embeddedResourceFileWriter.TargetFolderPath, "traject_6-3_vakken.shp"));
activity.Run();
activity.Finish();
}
}
}
}