// 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.TestUtil;
using NUnit.Framework;
using Ringtoets.Piping.Primitives;
namespace Ringtoets.Piping.KernelWrapper.TestUtil.Test
{
[TestFixture]
public class PipingSoilProfileTestFactoryTest
{
[Test]
public void CreatePipingSoilProfile_ReturnsPipingSoilProfile()
{
// Call
PipingSoilProfile soilProfile = PipingSoilProfileTestFactory.CreatePipingSoilProfile();
// Assert
Assert.AreEqual("name", soilProfile.Name);
Assert.AreEqual(0, soilProfile.Bottom);
Assert.AreEqual(SoilProfileType.SoilProfile1D, soilProfile.SoilProfileSourceType);
var expectedLayer = new PipingSoilLayer(1.0);
Assert.AreEqual(1, soilProfile.Layers.Count());
AssertAreEqual(expectedLayer, soilProfile.Layers.Single());
}
[Test]
public void CreatePipingSoilProfileWithName_ReturnsPipingSoilProfile()
{
// Setup
const string name = "Some name";
// Call
PipingSoilProfile soilProfile = PipingSoilProfileTestFactory.CreatePipingSoilProfile(name);
// Assert
Assert.AreEqual(name, soilProfile.Name);
Assert.AreEqual(0, soilProfile.Bottom);
Assert.AreEqual(SoilProfileType.SoilProfile1D, soilProfile.SoilProfileSourceType);
var expectedLayer = new PipingSoilLayer(1.0);
Assert.AreEqual(1, soilProfile.Layers.Count());
AssertAreEqual(expectedLayer, soilProfile.Layers.Single());
}
[Test]
public void CreatePipingSoilProfileWithNameAndType_ReturnsPipingSoilProfile()
{
// Setup
const string name = "Some name";
var type = new Random(123).NextEnumValue();
// Call
PipingSoilProfile soilProfile = PipingSoilProfileTestFactory.CreatePipingSoilProfile(name, type);
// Assert
Assert.AreEqual(name, soilProfile.Name);
Assert.AreEqual(0, soilProfile.Bottom);
Assert.AreEqual(type, soilProfile.SoilProfileSourceType);
var expectedLayer = new PipingSoilLayer(1.0);
Assert.AreEqual(1, soilProfile.Layers.Count());
AssertAreEqual(expectedLayer, soilProfile.Layers.Single());
}
private static void AssertAreEqual(PipingSoilLayer expected, PipingSoilLayer actual)
{
Assert.AreEqual(expected.Top, actual.Top);
Assert.AreEqual(expected.MaterialName, actual.MaterialName);
Assert.AreEqual(expected.BelowPhreaticLevelMean, actual.BelowPhreaticLevelMean);
Assert.AreEqual(expected.BelowPhreaticLevelDeviation, actual.BelowPhreaticLevelDeviation);
Assert.AreEqual(expected.BelowPhreaticLevelShift, actual.BelowPhreaticLevelShift);
Assert.AreEqual(expected.DiameterD70Mean, actual.DiameterD70Mean);
Assert.AreEqual(expected.DiameterD70CoefficientOfVariation, actual.DiameterD70CoefficientOfVariation);
Assert.AreEqual(expected.PermeabilityMean, actual.PermeabilityMean);
Assert.AreEqual(expected.PermeabilityCoefficientOfVariation, actual.PermeabilityCoefficientOfVariation);
}
}
}