Index: Core/Gui/src/Core.Gui/Plugin/StateInfo.cs =================================================================== diff -u -r6bce1d3c2cb767854105e8e8879ce9659c0ad9f0 -r419dd49f7777c795062212c60890eca33bc21653 --- Core/Gui/src/Core.Gui/Plugin/StateInfo.cs (.../StateInfo.cs) (revision 6bce1d3c2cb767854105e8e8879ce9659c0ad9f0) +++ Core/Gui/src/Core.Gui/Plugin/StateInfo.cs (.../StateInfo.cs) (revision 419dd49f7777c795062212c60890eca33bc21653) @@ -34,10 +34,11 @@ /// /// The symbol of the state. /// The method for obtaining the root data of the state. - public StateInfo(string symbol, Func getRootData) + /// Thrown when is null. + public StateInfo(string symbol, Func getRootData) { Symbol = symbol; - GetRootData = getRootData; + GetRootData = getRootData ?? throw new ArgumentNullException(nameof(getRootData)); } /// @@ -52,6 +53,6 @@ /// out - The root data object of the state. /// /// - public Func GetRootData { get; } + public Func GetRootData { get; } } } \ No newline at end of file Index: Core/Gui/test/Core.Gui.Test/Plugin/StateInfoTest.cs =================================================================== diff -u -r6bce1d3c2cb767854105e8e8879ce9659c0ad9f0 -r419dd49f7777c795062212c60890eca33bc21653 --- Core/Gui/test/Core.Gui.Test/Plugin/StateInfoTest.cs (.../StateInfoTest.cs) (revision 6bce1d3c2cb767854105e8e8879ce9659c0ad9f0) +++ Core/Gui/test/Core.Gui.Test/Plugin/StateInfoTest.cs (.../StateInfoTest.cs) (revision 419dd49f7777c795062212c60890eca33bc21653) @@ -19,6 +19,8 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. +using System; +using Core.Common.Base.Data; using Core.Gui.Plugin; using NUnit.Framework; @@ -32,13 +34,25 @@ { // Setup const string symbol = "Symbol"; + Func getRootData = o => new object(); // Call - var stateInfo = new StateInfo(symbol, null); + var stateInfo = new StateInfo(symbol, getRootData); // Assert Assert.AreEqual(symbol, stateInfo.Symbol); - Assert.IsNull(stateInfo.GetRootData); + Assert.AreSame(getRootData, stateInfo.GetRootData); } + + [Test] + public void Constructor_GetRootDataNull_ThrowsArgumentNullException() + { + // Call + void Call() => new StateInfo(string.Empty, null); + + // Assert + var exception = Assert.Throws(Call); + Assert.AreEqual("getRootData", exception.ParamName); + } } } \ No newline at end of file