Index: Ringtoets.sln =================================================================== diff -u -r80a9b97c1fdb7c9083f35d8f0b9352e8b0d65756 -r44eb76bb24f02be0f2fc2fac812e97263c1cf7d1 --- Ringtoets.sln (.../Ringtoets.sln) (revision 80a9b97c1fdb7c9083f35d8f0b9352e8b0d65756) +++ Ringtoets.sln (.../Ringtoets.sln) (revision 44eb76bb24f02be0f2fc2fac812e97263c1cf7d1) @@ -1982,7 +1982,7 @@ {C90B77DA-E421-43CC-B82E-529651BC21AC} = {C90B77DA-E421-43CC-B82E-529651BC21AC} EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Riskeer.AssemblyTool.IO.TestUtil", "Ringtoets\AssemblyTool\test\Ringtoets.AssemblyTool.IO.TestUtil\Riskeer.AssemblyTool.IO.TestUtil.csproj", "{C7023D25-F8DF-4E3F-BF5D-A8F961CC63F7}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Riskeer.AssemblyTool.IO.TestUtil", "Ringtoets\AssemblyTool\test\Riskeer.AssemblyTool.IO.TestUtil\Riskeer.AssemblyTool.IO.TestUtil.csproj", "{C7023D25-F8DF-4E3F-BF5D-A8F961CC63F7}" ProjectSection(ProjectDependencies) = postProject {C90B77DA-E421-43CC-B82E-529651BC21AC} = {C90B77DA-E421-43CC-B82E-529651BC21AC} EndProjectSection Fisheye: Tag 44eb76bb24f02be0f2fc2fac812e97263c1cf7d1 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.TestUtil/InvalidIdTestHelper.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 44eb76bb24f02be0f2fc2fac812e97263c1cf7d1 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.TestUtil/Properties/AssemblyInfo.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 44eb76bb24f02be0f2fc2fac812e97263c1cf7d1 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.TestUtil/Riskeer.AssemblyTool.IO.TestUtil.csproj'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 44eb76bb24f02be0f2fc2fac812e97263c1cf7d1 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.TestUtil/SerializableAttributeTestHelper.cs'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 44eb76bb24f02be0f2fc2fac812e97263c1cf7d1 refers to a dead (removed) revision in file `Ringtoets/AssemblyTool/test/Ringtoets.AssemblyTool.IO.TestUtil/packages.config'. Fisheye: No comparison available. Pass `N' to diff? Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.IO.TestUtil/InvalidIdTestHelper.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.IO.TestUtil/InvalidIdTestHelper.cs (revision 0) +++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.IO.TestUtil/InvalidIdTestHelper.cs (revision 44eb76bb24f02be0f2fc2fac812e97263c1cf7d1) @@ -0,0 +1,48 @@ +// Copyright (C) Stichting Deltares 2018. 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 NUnit.Framework; + +namespace Riskeer.AssemblyTool.IO.TestUtil +{ + /// + /// Class that can be used to generate invalid ids for the serializable components. + /// + public static class InvalidIdTestHelper + { + /// + /// Gets a collection of with invalid ids. + /// + public static IEnumerable InvalidIdCases + { + get + { + yield return new TestCaseData(null); + yield return new TestCaseData(""); + yield return new TestCaseData(" "); + yield return new TestCaseData("1nvalidId"); + yield return new TestCaseData("invalidId#"); + yield return new TestCaseData("invalid\rId"); + } + } + } +} \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.IO.TestUtil/Properties/AssemblyInfo.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.IO.TestUtil/Properties/AssemblyInfo.cs (revision 0) +++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.IO.TestUtil/Properties/AssemblyInfo.cs (revision 44eb76bb24f02be0f2fc2fac812e97263c1cf7d1) @@ -0,0 +1,25 @@ +// Copyright (C) Stichting Deltares 2018. 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.Reflection; + +[assembly: AssemblyTitle("Riskeer.AssemblyTool.IO.TestUtil")] +[assembly: AssemblyProduct("Riskeer.AssemblyTool.IO.TestUtil")] \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.IO.TestUtil/Riskeer.AssemblyTool.IO.TestUtil.csproj =================================================================== diff -u --- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.IO.TestUtil/Riskeer.AssemblyTool.IO.TestUtil.csproj (revision 0) +++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.IO.TestUtil/Riskeer.AssemblyTool.IO.TestUtil.csproj (revision 44eb76bb24f02be0f2fc2fac812e97263c1cf7d1) @@ -0,0 +1,32 @@ + + + + {C7023D25-F8DF-4E3F-BF5D-A8F961CC63F7} + Riskeer.AssemblyTool.IO.TestUtil + Riskeer.AssemblyTool.IO.TestUtil + + + + + + + + + + Copying.licenseheader + + + + + + ..\..\..\..\packages\NUnit.3.8.1\lib\net40\nunit.framework.dll + + + + + + {F49BD8B2-332A-4C91-A196-8CCE0A2C7D98} + Core.Common.Util + + + \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.IO.TestUtil/SerializableAttributeTestHelper.cs =================================================================== diff -u --- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.IO.TestUtil/SerializableAttributeTestHelper.cs (revision 0) +++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.IO.TestUtil/SerializableAttributeTestHelper.cs (revision 44eb76bb24f02be0f2fc2fac812e97263c1cf7d1) @@ -0,0 +1,109 @@ +// Copyright (C) Stichting Deltares 2018. 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.Collections.Generic; +using System.Linq; +using System.Xml.Serialization; +using Core.Common.Util.Reflection; +using NUnit.Framework; + +namespace Riskeer.AssemblyTool.IO.TestUtil +{ + /// + /// Test helper for asserting serialization attributes on properties and types. + /// + public static class SerializableAttributeTestHelper + { + /// + /// Asserts whether the has a with the correct values. + /// + /// The type to assert. + /// The expected XML type name. + /// Thrown when: + /// + /// does not match with the actual attribute; + /// multiple attributes of type were found. + /// + /// + public static void AssertXmlTypeAttribute(Type type, string typeName) + { + var attributes = (XmlTypeAttribute[]) type.GetCustomAttributes(typeof(XmlTypeAttribute), false); + Assert.AreEqual(1, attributes.Length); + Assert.AreEqual(typeName, attributes.Single().TypeName); + } + + /// + /// Asserts whether the property in class + /// has a with the correct values. + /// + /// The class the is in. + /// The name of the property to assert. + /// The expected XML element name. + /// The expected XML namespace url. + /// Thrown when: + /// + /// the could not be found + /// multiple attributes of type were found; + /// the or do not match + /// with the actual attribute. + /// + /// + public static void AssertXmlElementAttribute(string propertyName, string elementName, string namespaceUrl = null) + where T : class + { + XmlElementAttribute attribute = GetPropertyAttribute(propertyName); + Assert.AreEqual(elementName, attribute.ElementName); + Assert.AreEqual(namespaceUrl, attribute.Namespace); + } + + /// + /// Asserts whether the property in class + /// has a with the correct values. + /// + /// The class the is in. + /// The name of the property to assert. + /// The expected XML element name. + /// The expected XML namespace url. + /// Thrown when: + /// + /// the could not be found; + /// multiple attributes of type were found; + /// the actual attribute does not match with the given + /// and . + /// + /// + public static void AssertXmlAttributeAttribute(string propertyName, string elementName, string namespaceUrl = null) + where T : class + { + XmlAttributeAttribute attribute = GetPropertyAttribute(propertyName); + Assert.AreEqual(elementName, attribute.AttributeName); + Assert.AreEqual(namespaceUrl, attribute.Namespace); + } + + private static TAttribute GetPropertyAttribute(string propertyName) + { + IEnumerable attributes = TypeUtils.GetPropertyAttributes(propertyName); + Assert.AreEqual(1, attributes.Count()); + return attributes.Single(); + } + } +} \ No newline at end of file Index: Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.IO.TestUtil/packages.config =================================================================== diff -u --- Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.IO.TestUtil/packages.config (revision 0) +++ Ringtoets/AssemblyTool/test/Riskeer.AssemblyTool.IO.TestUtil/packages.config (revision 44eb76bb24f02be0f2fc2fac812e97263c1cf7d1) @@ -0,0 +1,25 @@ + + + + \ No newline at end of file