Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs =================================================================== diff -u -r31012b85637f7fcf6b28f498fc996edcda2eb505 -r66b07e7599319ea71ff109d8303f74a4a2e5f71c --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs (.../StorageSqLiteIntegrationTest.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/IntegrationTests/StorageSqLiteIntegrationTest.cs (.../StorageSqLiteIntegrationTest.cs) (revision 66b07e7599319ea71ff109d8303f74a4a2e5f71c) @@ -535,8 +535,8 @@ CollectionAssert.AreEqual(expectedReferenceLine.Points, actualReferenceLine.Points); } - private static void AssertStochasticSoilModels(ObservableCollectionWithSourcePath expectedModels, - ObservableCollectionWithSourcePath actualModels) + private static void AssertStochasticSoilModels(ObservableUniqueItemCollectionWithSourcePath expectedModels, + ObservableUniqueItemCollectionWithSourcePath actualModels) { // Precondition: Assert.Less(0, actualModels.Count); @@ -605,8 +605,8 @@ } } - private static void AssertSurfaceLines(ObservableCollectionWithSourcePath expectedSurfaceLines, - ObservableCollectionWithSourcePath actualSurfaceLines) + private static void AssertSurfaceLines(ObservableUniqueItemCollectionWithSourcePath expectedSurfaceLines, + ObservableUniqueItemCollectionWithSourcePath actualSurfaceLines) { // Precondition: Assert.Greater(expectedSurfaceLines.Count, 0); Index: Core/Common/src/Core.Common.Base/Core.Common.Base.csproj =================================================================== diff -u -r974fb1eadbd8a630c7a992648ad42ac85ec205b1 -r66b07e7599319ea71ff109d8303f74a4a2e5f71c --- Core/Common/src/Core.Common.Base/Core.Common.Base.csproj (.../Core.Common.Base.csproj) (revision 974fb1eadbd8a630c7a992648ad42ac85ec205b1) +++ Core/Common/src/Core.Common.Base/Core.Common.Base.csproj (.../Core.Common.Base.csproj) (revision 66b07e7599319ea71ff109d8303f74a4a2e5f71c) @@ -105,7 +105,7 @@ - + Fisheye: Tag 66b07e7599319ea71ff109d8303f74a4a2e5f71c refers to a dead (removed) revision in file `Core/Common/src/Core.Common.Base/ObservableCollectionWithSourcePath.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Common/src/Core.Common.Base/ObservableUniqueItemCollectionWithSourcePath.cs =================================================================== diff -u --- Core/Common/src/Core.Common.Base/ObservableUniqueItemCollectionWithSourcePath.cs (revision 0) +++ Core/Common/src/Core.Common.Base/ObservableUniqueItemCollectionWithSourcePath.cs (revision 66b07e7599319ea71ff109d8303f74a4a2e5f71c) @@ -0,0 +1,188 @@ +// 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 Lesser 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 Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser 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.Collections; +using System.Collections.Generic; +using System.Linq; +using Core.Common.Utils; + +namespace Core.Common.Base +{ + /// + /// A collection to store unique elements based on their feature and the source path + /// they were imported from. + /// + /// The type of elements in the collection. + public class ObservableUniqueItemCollectionWithSourcePath : Observable, IEnumerable + where TObject : class + { + private readonly List collection = new List(); + + /// + /// Gets the element at index in the collection. + /// + /// The index. + /// The element at index in the collection. + /// Thrown when is not + /// between [0, ) + public TObject this[int i] + { + get + { + return collection[i]; + } + } + + /// + /// Gets the amount of items stored in the collection. + /// + public int Count + { + get + { + return collection.Count; + } + } + + /// + /// Gets the last known file path from which the elements were imported. + /// + /// The path where the elements originate + /// from, or null if the collection is cleared. + public string SourcePath { get; private set; } + + /// + /// Removes the first occurrence of in the collection. + /// + /// The item of type to be removed. + /// True if the was successfully removed from the collection; + /// False if otherwise or if the was not found in the collection. + public bool Remove(TObject item) + { + bool remove = collection.Remove(item); + if (remove && Count == 0) + { + SourcePath = null; + } + return remove; + } + + /// + /// Clears the imported items in the collection and the . + /// + public void Clear() + { + SourcePath = null; + collection.Clear(); + } + + /// + /// Adds all elements originating from a source file. + /// + /// The elements to add + /// The path to the source file. + /// Thrown when any input argument is null. + /// Thrown when: + /// + /// contains null. + /// is not a valid file path. + /// an element in is invalid. + /// + /// + public void AddRange(IEnumerable items, string filePath) + { + if (items == null) + { + throw new ArgumentNullException(nameof(items)); + } + if (filePath == null) + { + throw new ArgumentNullException(nameof(filePath)); + } + if (!IOUtils.IsValidFilePath(filePath)) + { + throw new ArgumentException($"'{filePath}' is not a valid filepath.", nameof(filePath)); + } + InternalValidateItems(items); + + SourcePath = filePath; + collection.AddRange(items); + } + + private void InternalValidateItems(IEnumerable items) + { + if (items.Contains(null)) + { + throw new ArgumentException("Collection cannot contain null.", nameof(items)); + } + ValidateItems(items); + } + + /// + /// Perform additional validations over . + /// + /// The items to validate. + /// Throw an exception when validation fails. + protected virtual void ValidateItems(IEnumerable items) {} + + /// + /// Validates the items of an based on their names. + /// + /// The feautre that needs to be validated on. + /// The collection that needs to be validated. + /// The feature of the items contained by the collection + /// that needs to be validated on. + /// The description of the item which was validated. + /// The description of the feature which was validated on. + /// Thrown when any parameters are null. + /// Thrown when a duplicate item was found. + protected void ValidateListOnDuplicateFeature(IEnumerable items, + Func getUniqueFeature, + string typeDescriptor, + string featureDescription) + { + IEnumerable> duplicateItems = + items.GroupBy(getUniqueFeature) + .Where(group => group.Count() > 1); + + if (duplicateItems.Any()) + { + var duplicateFeatures = string.Join(", ", duplicateItems.Select(group => group.First())); + string exceptionMessage = string.Format("{0} moeten een unieke {1} hebben. Gevonden dubbele elementen: {2}.", + typeDescriptor, + featureDescription, + duplicateFeatures); + throw new ArgumentException(exceptionMessage); + } + } + + public IEnumerator GetEnumerator() + { + return collection.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} \ No newline at end of file Index: Core/Common/test/Core.Common.Base.Test/Core.Common.Base.Test.csproj =================================================================== diff -u -r974fb1eadbd8a630c7a992648ad42ac85ec205b1 -r66b07e7599319ea71ff109d8303f74a4a2e5f71c --- Core/Common/test/Core.Common.Base.Test/Core.Common.Base.Test.csproj (.../Core.Common.Base.Test.csproj) (revision 974fb1eadbd8a630c7a992648ad42ac85ec205b1) +++ Core/Common/test/Core.Common.Base.Test/Core.Common.Base.Test.csproj (.../Core.Common.Base.Test.csproj) (revision 66b07e7599319ea71ff109d8303f74a4a2e5f71c) @@ -102,7 +102,7 @@ - + Fisheye: Tag 66b07e7599319ea71ff109d8303f74a4a2e5f71c refers to a dead (removed) revision in file `Core/Common/test/Core.Common.Base.Test/ObservableCollectionWithSourcePathTest.cs'. Fisheye: No comparison available. Pass `N' to diff? Index: Core/Common/test/Core.Common.Base.Test/ObservableUniqueItemCollectionWithSourcePathTest.cs =================================================================== diff -u --- Core/Common/test/Core.Common.Base.Test/ObservableUniqueItemCollectionWithSourcePathTest.cs (revision 0) +++ Core/Common/test/Core.Common.Base.Test/ObservableUniqueItemCollectionWithSourcePathTest.cs (revision 66b07e7599319ea71ff109d8303f74a4a2e5f71c) @@ -0,0 +1,417 @@ +// 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 Lesser 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 Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser 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 Rhino.Mocks; + +namespace Core.Common.Base.Test +{ + [TestFixture] + public class ObservableUniqueItemCollectionWithSourcePathTest + { + [Test] + public void DefaultConstructor_ReturnObservableCollectionWithSourcePath() + { + // Call + var collection = new ObservableUniqueItemCollectionWithSourcePath(); + + // Assert + Assert.IsInstanceOf(collection); + Assert.IsNull(collection.SourcePath); + Assert.AreEqual(0, collection.Count); + CollectionAssert.IsEmpty(collection); + } + + [Test] + public void AddRange_ItemsNull_ThrowArgumentNullException() + { + // Setup + var collection = new ObservableUniqueItemCollectionWithSourcePath(); + + // Call + TestDelegate call = () => collection.AddRange(null, "path"); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("items", paramName); + } + + [Test] + public void AddRange_ItemsHasNullElement_ThrowArgumentException() + { + // Setup + var collection = new ObservableUniqueItemCollectionWithSourcePath(); + var items = new[] + { + new object(), + null, + new object() + }; + + // Call + TestDelegate call = () => collection.AddRange(items, "path"); + + // Assert + string message = "Collection cannot contain null."; + string paramName = TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, message).ParamName; + Assert.AreEqual("items", paramName); + } + + [Test] + public void AddRange_FilePathNull_ThrowArgumentNullException() + { + // Setup + var collection = new ObservableUniqueItemCollectionWithSourcePath(); + + // Call + TestDelegate call = () => collection.AddRange(Enumerable.Empty(), null); + + // Assert + string paramName = Assert.Throws(call).ParamName; + Assert.AreEqual("filePath", paramName); + } + + [Test] + public void AddRange_NotAnActualFilePath_ThrowArgumentNull() + { + // Setup + var collection = new ObservableUniqueItemCollectionWithSourcePath(); + + const string invalidFilePath = @" "; + + // Call + TestDelegate call = () => collection.AddRange(Enumerable.Empty(), invalidFilePath); + + // Assert + string message = $"'{invalidFilePath}' is not a valid filepath."; + string paramName = TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, message).ParamName; + Assert.AreEqual("filePath", paramName); + } + + [Test] + public void AddRange_AddNewItem_CollectionContainsItem() + { + // Setup + var collection = new ObservableUniqueItemCollectionWithSourcePath(); + var item = new object(); + + // Call + const string filePath = "some/file/path"; + collection.AddRange(new[] + { + item + }, filePath); + + // Assert + CollectionAssert.Contains(collection, item); + Assert.AreEqual(filePath, collection.SourcePath); + } + + [Test] + public void AddRange_AddingNewItems_CollectionContainsExpectedElements() + { + // Setup + var collection = new ObservableUniqueItemCollectionWithSourcePath(); + var expectedCollection = new[] + { + new object(), + new object(), + new object(), + new object() + }; + + const string filePath = "some/file/path"; + + // Call + collection.AddRange(expectedCollection, filePath); + + // Assert + CollectionAssert.AreEqual(expectedCollection, collection); + Assert.AreEqual(filePath, collection.SourcePath); + } + + [Test] + public void Count_CollectionFilledWithElements_ReturnsExpectedNumberOfElements() + { + // Setup + var collection = new ObservableUniqueItemCollectionWithSourcePath(); + collection.AddRange(new[] + { + new object(), + new object(), + new object(), + new object() + }, "path"); + + // Call + int nrOfElements = collection.Count; + + // Assert + Assert.AreEqual(4, nrOfElements); + } + + [Test] + [TestCase(-1)] + [TestCase(0)] + public void Indexer_GetItemAtIndexOutOfRange_ThrowsArgumentOutOfRangeException(int invalidIndex) + { + // Setup + var collection = new ObservableUniqueItemCollectionWithSourcePath(); + + // Call + TestDelegate call = () => + { + object item = collection[invalidIndex]; + }; + + // Assert + Assert.Throws(call); + } + + [Test] + public void Indexer_GetElementAtIndex_ReturnsExpectedElement() + { + // Setup + var elementToRetrieve = new object(); + var collection = new ObservableUniqueItemCollectionWithSourcePath(); + collection.AddRange(new[] + { + new object(), + new object(), + new object(), + new object(), + elementToRetrieve + }, "path"); + + // Call + object retrievedElement = collection[4]; + + // Assert + Assert.AreSame(elementToRetrieve, retrievedElement); + } + + [Test] + public void Remove_ElementNotInList_ReturnsFalse() + { + // Setup + var element = new object(); + + var collection = new ObservableUniqueItemCollectionWithSourcePath(); + var expectedCollection = new[] + { + new object(), + new object(), + new object(), + new object() + }; + + collection.AddRange(expectedCollection, "path"); + + // Call + bool removeSuccessful = collection.Remove(element); + + // Assert + Assert.IsFalse(removeSuccessful); + CollectionAssert.AreEqual(expectedCollection, collection); + } + + [Test] + public void Remove_ElementInCollection_ReturnsTrue() + { + // Setup + var elementToBeRemoved = new object(); + + var collection = new ObservableUniqueItemCollectionWithSourcePath(); + var expectedCollections = new[] + { + new object(), + new object(), + new object(), + new object() + }; + + collection.AddRange(expectedCollections.Concat(new[] + { + elementToBeRemoved + }), "path"); + + // Call + bool removeSuccessful = collection.Remove(elementToBeRemoved); + + // Assert + Assert.IsTrue(removeSuccessful); + CollectionAssert.AreEqual(expectedCollections, collection); + } + + [Test] + public void Remove_ElementToRemoveMultiplesInCollection_ReturnsTrueAndRemovesFirstOccurence() + { + // Setup + var elementToBeRemoved = new object(); + + var collection = new ObservableUniqueItemCollectionWithSourcePath(); + var removeElementCollection = new[] + { + elementToBeRemoved + }; + var expectedCollection = new[] + { + new object(), + new object(), + new object(), + new object(), + elementToBeRemoved + }; + + collection.AddRange(removeElementCollection.Concat(expectedCollection), "path"); + + // Call + bool removeSuccessful = collection.Remove(elementToBeRemoved); + + // Assert + Assert.IsTrue(removeSuccessful); + CollectionAssert.AreEqual(expectedCollection, collection); + } + + [Test] + public void Remove_RemoveLastElement_ReturnsTrueAndClearSourcePath() + { + // Setup + var elementToBeRemoved = new object(); + var collection = new ObservableUniqueItemCollectionWithSourcePath(); + collection.AddRange(new[] + { + elementToBeRemoved + }, "path"); + + // Precondition + Assert.IsNotNull(collection.SourcePath); + + // Call + bool removeSuccesful = collection.Remove(elementToBeRemoved); + + // Assert + Assert.IsTrue(removeSuccesful); + Assert.IsNull(collection.SourcePath); + } + + [Test] + public void Clear_CollectionFullyDefined_ClearsSourcePathAndCollection() + { + // Setup + var collection = new ObservableUniqueItemCollectionWithSourcePath(); + var expectedObjectCollection = new[] + { + new object(), + new object(), + new object(), + new object() + }; + + collection.AddRange(expectedObjectCollection, "path"); + + // Call + collection.Clear(); + + // Assert + Assert.IsNull(collection.SourcePath); + Assert.AreEqual(0, collection.Count); + CollectionAssert.IsEmpty(collection); + } + + [Test] + public void NotifyObservers_WithObserverAttached_ObserverIsNotified() + { + // Setup + var mocks = new MockRepository(); + var observer = mocks.StrictMock(); + observer.Expect(o => o.UpdateObserver()); // Expect to be called once + mocks.ReplayAll(); + + var observableCollection = new ObservableUniqueItemCollectionWithSourcePath(); + observableCollection.Attach(observer); + + // Call + observableCollection.NotifyObservers(); + + // Assert + mocks.VerifyAll(); + } + + [Test] + public void NotifyObserver_AttachedObserverDetachedAgain_ObserverNoLongerNotified() + { + // Setup + var mocks = new MockRepository(); + var observer = mocks.StrictMock(); + mocks.ReplayAll(); + + var observableCollection = new ObservableUniqueItemCollectionWithSourcePath(); + observableCollection.Attach(observer); + observableCollection.Detach(observer); + + // Call + observableCollection.NotifyObservers(); + + // Assert + mocks.VerifyAll(); // Expect no calls on 'observer' + } + + [Test] + public void NotifyObservers_MultipleObserversDetachingOrAttachingOthers_NoUpdatesForAttachedAndDetachedObservers() + { + // Setup + var mocks = new MockRepository(); + var observableCollection = new ObservableUniqueItemCollectionWithSourcePath(); + + var observer1 = mocks.Stub(); + var observer2 = mocks.Stub(); + var observer3 = mocks.Stub(); + var observer4 = mocks.Stub(); + var observer5 = mocks.Stub(); + var observer6 = mocks.Stub(); + + observableCollection.Attach(observer1); + observableCollection.Attach(observer2); + observableCollection.Attach(observer3); + observableCollection.Attach(observer4); + observableCollection.Attach(observer6); + + observer1.Expect(o => o.UpdateObserver()); + observer2.Expect(o => o.UpdateObserver()).Do((Action) (() => observableCollection.Detach(observer3))); + observer3.Expect(o => o.UpdateObserver()).Repeat.Never(); // A detached observer should no longer be updated + observer4.Expect(o => o.UpdateObserver()).Do((Action) (() => observableCollection.Attach(observer5))); + observer5.Expect(o => o.UpdateObserver()).Repeat.Never(); // An attached observer should not be updated too + observer6.Expect(o => o.UpdateObserver()); + + mocks.ReplayAll(); + + // Call + observableCollection.NotifyObservers(); + + // Assert + mocks.VerifyAll(); + } + } +} \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/RingtoetsPipingSurfaceLineCollection.cs =================================================================== diff -u -r393f18543bc78061b83f61fce09ca094d8fb1a05 -r66b07e7599319ea71ff109d8303f74a4a2e5f71c --- Ringtoets/Piping/src/Ringtoets.Piping.Data/RingtoetsPipingSurfaceLineCollection.cs (.../RingtoetsPipingSurfaceLineCollection.cs) (revision 393f18543bc78061b83f61fce09ca094d8fb1a05) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/RingtoetsPipingSurfaceLineCollection.cs (.../RingtoetsPipingSurfaceLineCollection.cs) (revision 66b07e7599319ea71ff109d8303f74a4a2e5f71c) @@ -19,36 +19,20 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using System; using System.Collections.Generic; -using System.Linq; using Core.Common.Base; -using Ringtoets.Piping.Data.Properties; using Ringtoets.Piping.Primitives; namespace Ringtoets.Piping.Data { /// /// Collection to store . /// - public class RingtoetsPipingSurfaceLineCollection : ObservableCollectionWithSourcePath + public class RingtoetsPipingSurfaceLineCollection : ObservableUniqueItemCollectionWithSourcePath { - private const string separator = ", "; - protected override void ValidateItems(IEnumerable items) { - IEnumerable> duplicateItems = - items.GroupBy(item => item.Name) - .Where(group => group.Count() > 1); - - if (duplicateItems.Any()) - { - var names = string.Join(separator, duplicateItems.Select(group => group.First())); - string message = string.Format( - Resources.RingtoetsPipingSurfaceLineCollection_ValidateItems_RingtoetsPipingSurfaceLine_require_unique_names_found_duplicate_items_0_, - names); - throw new ArgumentException(message); - } + ValidateListOnDuplicateFeature(items, line => line.Name, "Profielschematisaties", "naam"); } } } \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/StochasticSoilModelCollection.cs =================================================================== diff -u -r8eb717ca45b6518cccfef85e481e0da52ce1df4e -r66b07e7599319ea71ff109d8303f74a4a2e5f71c --- Ringtoets/Piping/src/Ringtoets.Piping.Data/StochasticSoilModelCollection.cs (.../StochasticSoilModelCollection.cs) (revision 8eb717ca45b6518cccfef85e481e0da52ce1df4e) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/StochasticSoilModelCollection.cs (.../StochasticSoilModelCollection.cs) (revision 66b07e7599319ea71ff109d8303f74a4a2e5f71c) @@ -19,26 +19,19 @@ // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. -using System; using System.Collections.Generic; -using System.Linq; using Core.Common.Base; namespace Ringtoets.Piping.Data { /// /// A collection of . /// - public class StochasticSoilModelCollection : ObservableCollectionWithSourcePath + public class StochasticSoilModelCollection : ObservableUniqueItemCollectionWithSourcePath { protected override void ValidateItems(IEnumerable items) { - IEnumerable> duplicates = items.GroupBy(m => m.Name).Where(g => g.Count() > 1); - if(duplicates.Any()) - { - var names = string.Join(", ", duplicates.Select(g => g.First())); - throw new ArgumentException($@"Ondergrondmodellen moeten een unieke naam hebben. Gevonden dubbele namen: {names}."); - } + ValidateListOnDuplicateFeature(items, model => model.Name, "Ondergrondmodellen", "naam"); } } } \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/RingtoetsPipingSurfaceLineCollectionProperties.cs =================================================================== diff -u -r922e186b7941457f71de9b4909fa2490f36a1c63 -r66b07e7599319ea71ff109d8303f74a4a2e5f71c --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/RingtoetsPipingSurfaceLineCollectionProperties.cs (.../RingtoetsPipingSurfaceLineCollectionProperties.cs) (revision 922e186b7941457f71de9b4909fa2490f36a1c63) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/RingtoetsPipingSurfaceLineCollectionProperties.cs (.../RingtoetsPipingSurfaceLineCollectionProperties.cs) (revision 66b07e7599319ea71ff109d8303f74a4a2e5f71c) @@ -30,17 +30,17 @@ namespace Ringtoets.Piping.Forms.PropertyClasses { /// - /// ViewModel of of for properties panel. + /// ViewModel of of for properties panel. /// - public class RingtoetsPipingSurfaceLineCollectionProperties : ObjectProperties> + public class RingtoetsPipingSurfaceLineCollectionProperties : ObjectProperties> { /// /// Creates a new instance of . /// /// The collection for which the properties are shown. /// Thrown when /// is null. - public RingtoetsPipingSurfaceLineCollectionProperties(ObservableCollectionWithSourcePath collection) + public RingtoetsPipingSurfaceLineCollectionProperties(ObservableUniqueItemCollectionWithSourcePath collection) { if (collection == null) { Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/StochasticSoilModelCollectionProperties.cs =================================================================== diff -u -r922e186b7941457f71de9b4909fa2490f36a1c63 -r66b07e7599319ea71ff109d8303f74a4a2e5f71c --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/StochasticSoilModelCollectionProperties.cs (.../StochasticSoilModelCollectionProperties.cs) (revision 922e186b7941457f71de9b4909fa2490f36a1c63) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/StochasticSoilModelCollectionProperties.cs (.../StochasticSoilModelCollectionProperties.cs) (revision 66b07e7599319ea71ff109d8303f74a4a2e5f71c) @@ -30,17 +30,17 @@ namespace Ringtoets.Piping.Forms.PropertyClasses { /// - /// ViewModel of of for properties panel. + /// ViewModel of of for properties panel. /// - public class StochasticSoilModelCollectionProperties : ObjectProperties> + public class StochasticSoilModelCollectionProperties : ObjectProperties> { /// /// Creates a new instance of . /// /// The collection for which the properties are shown. /// Thrown when /// is null. - public StochasticSoilModelCollectionProperties(ObservableCollectionWithSourcePath collection) + public StochasticSoilModelCollectionProperties(ObservableUniqueItemCollectionWithSourcePath collection) { if (collection == null) { Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingFailureMechanismView.cs =================================================================== diff -u -r31012b85637f7fcf6b28f498fc996edcda2eb505 -r66b07e7599319ea71ff109d8303f74a4a2e5f71c --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingFailureMechanismView.cs (.../PipingFailureMechanismView.cs) (revision 31012b85637f7fcf6b28f498fc996edcda2eb505) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/Views/PipingFailureMechanismView.cs (.../PipingFailureMechanismView.cs) (revision 66b07e7599319ea71ff109d8303f74a4a2e5f71c) @@ -197,8 +197,8 @@ { ReferenceLine referenceLine = data.Parent.ReferenceLine; IEnumerable failureMechanismSections = data.WrappedData.Sections; - ObservableCollectionWithSourcePath stochasticSoilModels = data.WrappedData.StochasticSoilModels; - ObservableCollectionWithSourcePath ringtoetsPipingSurfaceLines = data.WrappedData.SurfaceLines; + ObservableUniqueItemCollectionWithSourcePath stochasticSoilModels = data.WrappedData.StochasticSoilModels; + ObservableUniqueItemCollectionWithSourcePath ringtoetsPipingSurfaceLines = data.WrappedData.SurfaceLines; HydraulicBoundaryDatabase hydraulicBoundaryDatabase = data.Parent.HydraulicBoundaryDatabase; IEnumerable calculations = data.WrappedData.CalculationsGroup.GetCalculations().Cast(); Index: Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/IStochasticSoilModelUpdateModelStrategy.cs =================================================================== diff -u -re1a8e98d60853beefbdb8c84e70f14165680ad7b -r66b07e7599319ea71ff109d8303f74a4a2e5f71c --- Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/IStochasticSoilModelUpdateModelStrategy.cs (.../IStochasticSoilModelUpdateModelStrategy.cs) (revision e1a8e98d60853beefbdb8c84e70f14165680ad7b) +++ Ringtoets/Piping/src/Ringtoets.Piping.IO/Importers/IStochasticSoilModelUpdateModelStrategy.cs (.../IStochasticSoilModelUpdateModelStrategy.cs) (revision 66b07e7599319ea71ff109d8303f74a4a2e5f71c) @@ -35,7 +35,7 @@ /// /// Adds the imported data to the . /// - /// The to which the imported data + /// The to which the imported data /// is added. /// The stochastic soil models which were imported. /// The path to the source file from which the soil models were imported. Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/RingtoetsPipingSurfaceLineCollectionTest.cs =================================================================== diff -u -r92549be285a5082435e9625732cf33ff50cd60b9 -r66b07e7599319ea71ff109d8303f74a4a2e5f71c --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/RingtoetsPipingSurfaceLineCollectionTest.cs (.../RingtoetsPipingSurfaceLineCollectionTest.cs) (revision 92549be285a5082435e9625732cf33ff50cd60b9) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/RingtoetsPipingSurfaceLineCollectionTest.cs (.../RingtoetsPipingSurfaceLineCollectionTest.cs) (revision 66b07e7599319ea71ff109d8303f74a4a2e5f71c) @@ -37,7 +37,7 @@ var collection = new RingtoetsPipingSurfaceLineCollection(); // Assert - Assert.IsInstanceOf>(collection); + Assert.IsInstanceOf>(collection); } [Test] @@ -90,7 +90,7 @@ TestDelegate call = () => collection.AddRange(surfaceLinesToAdd, "path"); // Assert - string message = $"Profielschematisaties moeten een unieke naam hebben. Gevonden dubbele namen: {duplicateName}."; + string message = $"Profielschematisaties moeten een unieke naam hebben. Gevonden dubbele elementen: {duplicateName}."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, message); } @@ -126,7 +126,7 @@ TestDelegate call = () => collection.AddRange(surfaceLinesToAdd, "path"); // Assert - string message = $"Profielschematisaties moeten een unieke naam hebben. Gevonden dubbele namen: {duplicateNameOne}, {duplicateNameTwo}."; + string message = $"Profielschematisaties moeten een unieke naam hebben. Gevonden dubbele elementen: {duplicateNameOne}, {duplicateNameTwo}."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, message); } } Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilModelCollectionTest.cs =================================================================== diff -u -r92549be285a5082435e9625732cf33ff50cd60b9 -r66b07e7599319ea71ff109d8303f74a4a2e5f71c --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilModelCollectionTest.cs (.../StochasticSoilModelCollectionTest.cs) (revision 92549be285a5082435e9625732cf33ff50cd60b9) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/StochasticSoilModelCollectionTest.cs (.../StochasticSoilModelCollectionTest.cs) (revision 66b07e7599319ea71ff109d8303f74a4a2e5f71c) @@ -36,7 +36,7 @@ var collection = new StochasticSoilModelCollection(); // Assert - Assert.IsInstanceOf>(collection); + Assert.IsInstanceOf>(collection); } [Test] @@ -76,7 +76,7 @@ TestDelegate call = () => collection.AddRange(modelsToAdd, "valid/file/path"); // Assert - string message = $"Ondergrondmodellen moeten een unieke naam hebben. Gevonden dubbele namen: {someName}."; + string message = $"Ondergrondmodellen moeten een unieke naam hebben. Gevonden dubbele elementen: {someName}."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, message); } @@ -100,7 +100,7 @@ TestDelegate call = () => collection.AddRange(modelsToAdd, "valid/file/path"); // Assert - string message = $"Ondergrondmodellen moeten een unieke naam hebben. Gevonden dubbele namen: {someName}, {someOtherName}."; + string message = $"Ondergrondmodellen moeten een unieke naam hebben. Gevonden dubbele elementen: {someName}, {someOtherName}."; TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, message); } } Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil.Test/TestPipingFailureMechanismTest.cs =================================================================== diff -u -rbdc32ff91af686a45b08e5f4f4a8d5b45eaba60f -r66b07e7599319ea71ff109d8303f74a4a2e5f71c --- Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil.Test/TestPipingFailureMechanismTest.cs (.../TestPipingFailureMechanismTest.cs) (revision bdc32ff91af686a45b08e5f4f4a8d5b45eaba60f) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil.Test/TestPipingFailureMechanismTest.cs (.../TestPipingFailureMechanismTest.cs) (revision 66b07e7599319ea71ff109d8303f74a4a2e5f71c) @@ -52,7 +52,7 @@ // Assert Assert.AreEqual(24, failureMechanism.Contribution); - ObservableCollectionWithSourcePath surfaceLines = failureMechanism.SurfaceLines; + ObservableUniqueItemCollectionWithSourcePath surfaceLines = failureMechanism.SurfaceLines; Assert.AreEqual("path/to/surfaceLines", surfaceLines.SourcePath); Assert.AreEqual(1, surfaceLines.Count); RingtoetsPipingSurfaceLine[] surfaceLineArray = surfaceLines.ToArray(); Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/RingtoetsPipingSurfaceLineCollectionPropertiesTest.cs =================================================================== diff -u -r580a0557ffdf6af30593c7a94c561b353a0400cb -r66b07e7599319ea71ff109d8303f74a4a2e5f71c --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/RingtoetsPipingSurfaceLineCollectionPropertiesTest.cs (.../RingtoetsPipingSurfaceLineCollectionPropertiesTest.cs) (revision 580a0557ffdf6af30593c7a94c561b353a0400cb) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/RingtoetsPipingSurfaceLineCollectionPropertiesTest.cs (.../RingtoetsPipingSurfaceLineCollectionPropertiesTest.cs) (revision 66b07e7599319ea71ff109d8303f74a4a2e5f71c) @@ -50,14 +50,14 @@ { // Setup var someFilePath = "location/to/a/file"; - var collection = new ObservableCollectionWithSourcePath(); + var collection = new ObservableUniqueItemCollectionWithSourcePath(); collection.AddRange(Enumerable.Empty(), someFilePath); // Call var properties = new RingtoetsPipingSurfaceLineCollectionProperties(collection); // Assert - Assert.IsInstanceOf>>(properties); + Assert.IsInstanceOf>>(properties); Assert.AreSame(collection, properties.Data); Assert.AreEqual(someFilePath, properties.SourcePath); } @@ -66,7 +66,7 @@ public void Constructor_WithData_PropertiesHaveExpectedAttributesValues() { // Setup - var collection = new ObservableCollectionWithSourcePath(); + var collection = new ObservableUniqueItemCollectionWithSourcePath(); // Call var properties = new RingtoetsPipingSurfaceLineCollectionProperties(collection); Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/StochasticSoilModelCollectionPropertiesTest.cs =================================================================== diff -u -r5ad23eae9f87bb12cbf453126070e8967e32d7ad -r66b07e7599319ea71ff109d8303f74a4a2e5f71c --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/StochasticSoilModelCollectionPropertiesTest.cs (.../StochasticSoilModelCollectionPropertiesTest.cs) (revision 5ad23eae9f87bb12cbf453126070e8967e32d7ad) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/StochasticSoilModelCollectionPropertiesTest.cs (.../StochasticSoilModelCollectionPropertiesTest.cs) (revision 66b07e7599319ea71ff109d8303f74a4a2e5f71c) @@ -50,14 +50,14 @@ { // Setup var someFilePath = "location/to/a/file"; - var collection = new ObservableCollectionWithSourcePath(); + var collection = new ObservableUniqueItemCollectionWithSourcePath(); collection.AddRange(Enumerable.Empty(), someFilePath); // Call var properties = new StochasticSoilModelCollectionProperties(collection); // Assert - Assert.IsInstanceOf>>(properties); + Assert.IsInstanceOf>>(properties); Assert.AreSame(collection, properties.Data); Assert.AreEqual(someFilePath, properties.SourcePath); } @@ -66,7 +66,7 @@ public void Constructor_WithData_PropertiesHaveExpectedAttributesValues() { // Setup - var collection = new ObservableCollectionWithSourcePath(); + var collection = new ObservableUniqueItemCollectionWithSourcePath(); // Call var properties = new StochasticSoilModelCollectionProperties(collection); Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/RingtoetsPipingSurfaceLineReplaceDataStrategyTest.cs =================================================================== diff -u -r036199c1cde97f98829dc4405169ec327d2a1b95 -r66b07e7599319ea71ff109d8303f74a4a2e5f71c --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/RingtoetsPipingSurfaceLineReplaceDataStrategyTest.cs (.../RingtoetsPipingSurfaceLineReplaceDataStrategyTest.cs) (revision 036199c1cde97f98829dc4405169ec327d2a1b95) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/RingtoetsPipingSurfaceLineReplaceDataStrategyTest.cs (.../RingtoetsPipingSurfaceLineReplaceDataStrategyTest.cs) (revision 66b07e7599319ea71ff109d8303f74a4a2e5f71c) @@ -265,7 +265,7 @@ // Assert var exception = Assert.Throws(call); - string expectedMessage = $"Profielschematisaties moeten een unieke naam hebben. Gevonden dubbele namen: {duplicateName}."; + string expectedMessage = $"Profielschematisaties moeten een unieke naam hebben. Gevonden dubbele elementen: {duplicateName}."; Assert.AreEqual(expectedMessage, exception.Message); Assert.IsInstanceOf(exception.InnerException); } Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/StochasticSoilModelReplaceDataStrategyTest.cs =================================================================== diff -u -re1a8e98d60853beefbdb8c84e70f14165680ad7b -r66b07e7599319ea71ff109d8303f74a4a2e5f71c --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/StochasticSoilModelReplaceDataStrategyTest.cs (.../StochasticSoilModelReplaceDataStrategyTest.cs) (revision e1a8e98d60853beefbdb8c84e70f14165680ad7b) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/StochasticSoilModelReplaceDataStrategyTest.cs (.../StochasticSoilModelReplaceDataStrategyTest.cs) (revision 66b07e7599319ea71ff109d8303f74a4a2e5f71c) @@ -225,7 +225,7 @@ // Assert var exception = Assert.Throws(test); - Assert.AreEqual("Ondergrondmodellen moeten een unieke naam hebben. Gevonden dubbele namen: B.", exception.Message); + Assert.AreEqual("Ondergrondmodellen moeten een unieke naam hebben. Gevonden dubbele elementen: B.", exception.Message); Assert.IsInstanceOf(exception.InnerException); } } Index: Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/StochasticSoilModelUpdateDataStrategyTest.cs =================================================================== diff -u -re1a8e98d60853beefbdb8c84e70f14165680ad7b -r66b07e7599319ea71ff109d8303f74a4a2e5f71c --- Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/StochasticSoilModelUpdateDataStrategyTest.cs (.../StochasticSoilModelUpdateDataStrategyTest.cs) (revision e1a8e98d60853beefbdb8c84e70f14165680ad7b) +++ Ringtoets/Piping/test/Ringtoets.Piping.Plugin.Test/FileImporter/StochasticSoilModelUpdateDataStrategyTest.cs (.../StochasticSoilModelUpdateDataStrategyTest.cs) (revision 66b07e7599319ea71ff109d8303f74a4a2e5f71c) @@ -149,7 +149,7 @@ // Assert var exception = Assert.Throws(test); - Assert.AreEqual("Ondergrondmodellen moeten een unieke naam hebben. Gevonden dubbele namen: non-unique name.", exception.Message); + Assert.AreEqual("Ondergrondmodellen moeten een unieke naam hebben. Gevonden dubbele elementen: non-unique name.", exception.Message); Assert.IsInstanceOf(exception.InnerException); }