// 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.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using Ringtoets.Common.Service.TestUtil;
namespace Ringtoets.Common.Plugin.TestUtil
{
///
/// Class containing helper methods used to assert the log messages of a calculation activity
/// for hydraulic boundary location calculations.
///
public static class HydraulicBoundaryLocationCalculationActivityLogTestHelper
{
///
/// Asserts whether contains the correct items given the other parameters.
///
/// The name of the location.
/// The display name of the type of calculation being performed.
/// The display name of the calculation being performed.
/// The category boundary name of the calculation.
/// The log messages to assert.
/// The index to start asserting from.
/// Thrown when
/// contains incorrect messages.
public static void AssertHydraulicBoundaryLocationCalculationMessages(string locationName,
string calculationTypeDisplayName,
string calculationDisplayName,
string categoryName,
IEnumerable actualMessages,
int startIndex)
{
Assert.AreEqual($"{calculationTypeDisplayName} berekenen voor locatie '{locationName}' (Categoriegrens {categoryName}) is gestart.",
actualMessages.ElementAt(startIndex));
CalculationServiceTestHelper.AssertValidationStartMessage(actualMessages.ElementAt(startIndex + 1));
CalculationServiceTestHelper.AssertValidationEndMessage(actualMessages.ElementAt(startIndex + 2));
CalculationServiceTestHelper.AssertCalculationStartMessage(actualMessages.ElementAt(startIndex + 3));
Assert.AreEqual($"{calculationDisplayName} voor locatie '{locationName}' (Categoriegrens {categoryName}) is niet geconvergeerd.",
actualMessages.ElementAt(startIndex + 4));
StringAssert.StartsWith($"{calculationDisplayName} is uitgevoerd op de tijdelijke locatie",
actualMessages.ElementAt(startIndex + 5));
CalculationServiceTestHelper.AssertCalculationEndMessage(actualMessages.ElementAt(startIndex + 6));
Assert.AreEqual($"{calculationTypeDisplayName} berekenen voor locatie '{locationName}' (Categoriegrens {categoryName}) is gelukt.",
actualMessages.ElementAt(startIndex + 7));
}
}
}